Hi! Does some one have a piece of code for websockets implemented in zend framework 2?
I would like to make a script for that, but I can't figure out how to translate a piece of code, from zf1 into zf2. Basically what it used to do is it accesed an action from a controller with some data (internally). And I could have accessed all kinds of things, like:vars, the output template, and plenty of things.. getVars and setVars were implemented by me because I didn't know how to set POST and POST vars for a request. Here it comes: <?php // Define path to application directory defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application')); // Define application environment defined('APPLICATION_ENV') || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production')); // Ensure library/ is on include_path set_include_path(implode(PATH_SEPARATOR, array( realpath(APPLICATION_PATH . '/../library'), get_include_path(), ))); /** Zend_Application */ require_once 'Zend/Application.php'; // Create application, bootstrap, and run $application = new Zend_Application( APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini' ); $application->bootstrap() ;#->run(); $options = array( 'action' => 'index' ,'controller' => 'index' ,'module' => 'default' ); $frontController = Zend_Controller_Front::getInstance ()->returnResponse ( true ); for($i = 0; $i < 100; $i++) { $r = dispatch(array($options['controller'], $options['module'], $options['action']), array('user_id' => $i%2 == 0 ? 1 : 2)); } /** * * @param array $options * [0] = controller * [1] = module * [2] = action * @param unknown_type $params */ function dispatch(array $options, array $params) { global $frontController; $request = new Zend_Controller_Request_Http (); $request->setModuleName($options[1])->setActionName($options[2])->setControllerName($options[0]) ->setParams($params); $response = new Zend_Controller_Response_Http (); $frontController->getDispatcher ()->dispatch ( $request, $response ); return $response->getVars(); } Big thanks! -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Framework-2-WebSockets-tp4659055.html Sent from the Zend Framework mailing list archive at Nabble.com. -- List: fw-general@lists.zend.com Info: http://framework.zend.com/archives Unsubscribe: fw-general-unsubscr...@lists.zend.com