$route = $this->getContext()->getRouting()->gen('', array(), 'websocket_server');
Result:
ws://project.host.local:8080/
Gen-Options-Presets in app/config/factories.xml
<routing class="AgaviWebRouting">
<ae:parameter name="gen_options_presets">
<ae:parameter name="websocket_server">
<ae:parameter name="omit_defaults">true</ae:parameter>
<ae:parameter name="relative">false</ae:parameter>
<ae:parameter name="authority"></ae:parameter>
<ae:parameter name="scheme">ws</ae:parameter>
<ae:parameter name="port">%event_pub.web_socket.port%</ae:parameter>
<ae:parameter name="prefix"></ae:parameter>
<ae:parameter name="fragment"></ae:parameter>
</ae:parameter>
</ae:parameter>
</routing>
Websocket server port specified in app/config/settings.xml
:
<settings prefix="event_pub.">
<setting name="web_socket.port">8080</setting>
</settings>