All Projects → Red5 → red5-websocket-chat

Red5 / red5-websocket-chat

Licence: Apache-2.0 License
Red5 WebSocket Chat Demo

Programming Languages

javascript
184084 projects - #8 most used programming language
java
68154 projects - #9 most used programming language
HTML
75241 projects

Chat application

Red5 WebSocket chat application example.

The example index.html defaults to using a WebSocket connection to localhost on port 5080. This means that the host and port are riding the same host and port as the http connector which is configured in the red5/conf/jee-container.xml file. Two new steps are required to migrate from the previous versions:

Add the websocketEnabled to the Tomcat server entry in the conf/jee-container.xml file

       <property name="websocketEnabled" value="true" />

Add the WebSocket filter servlet to webapps that require WebSocket support

        <filter>
            <filter-name>WebSocketFilter</filter-name>
            <filter-class>org.red5.net.websocket.server.WsFilter</filter-class>
            <async-supported>true</async-supported>
        </filter>
        <filter-mapping>
            <filter-name>WebSocketFilter</filter-name>
            <url-pattern>/*</url-pattern>
            <dispatcher>REQUEST</dispatcher>
            <dispatcher>FORWARD</dispatcher>
        </filter-mapping>

Lastly, remove any separate webSocketTransport beans from the conf/jee-container.xml file.

<bean id="webSocketTransport" class="org.red5.net.websocket.WebSocketTransport">
    <property name="addresses">
        <list>
            <value>localhost:8081</value>
        </list>
    </property>
</bean>

Build the application from the command line with

mvn package

Deploy your application by copying the war file into your red5/webapps directory.

After deploy is complete, go to http://localhost:5080/chat/ in your browser (open two tabs if you want to chat back and forth on the same computer).

Pre-compiled WAR

You can find compiled artifacts via Maven

Direct Download

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].