You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example `index.html` defaults to using a WebSocket connection to localhost on port 5080.
5
+
The example `index.html` defaults to using a WebSocket connection; SSE is also supported. Change the host and port entries to match your server as needed.
6
6
7
7
## Add the WebSocket filter servlet to webapps that require WebSocket support
<!-- use CORS internally if no other CORS is enabled -->
32
+
<init-param>
33
+
<param-name>cors.enabled</param-name>
34
+
<param-value>false</param-value>
35
+
</init-param>
36
+
</servlet>
37
+
<servlet-mapping>
38
+
<servlet-name>sse</servlet-name>
39
+
<url-pattern>/events</url-pattern>
40
+
<url-pattern>/events/*</url-pattern>
41
+
</servlet-mapping>
42
+
```
43
+
44
+
## Build and Deploy
45
+
23
46
Build the application from the command line with
24
47
25
48
```sh
26
49
mvn package
27
50
```
28
51
52
+
If you are using Red5 Pro, you will need to modify the WebSocket connection URL to include the appropriate capabilities parameter:
53
+
54
+
```javascript
55
+
/*
56
+
if we're hitting a red5pro server, ensure the port is 5080 and wsonly is true (for websocket only mode)
57
+
?capabilities=1 : WebSocket Connection only
58
+
?capabilities=3 : RTCConnection
59
+
*/
60
+
var socket =newWebSocket(protocol +'://'+window.location.hostname+':'+ port +'/chat/?capabilities=1', 'chat');
61
+
// std red5
62
+
//var socket = new WebSocket(protocol + '://' + window.location.hostname + ':' + port + '/chat', 'chat');
63
+
```
64
+
29
65
Deploy your application by copying the war file into your `red5/webapps` directory. If the war file does not deploy withing a few minutes, this may indicate the war deployer bean is not created or running; a work-around is to expand the war contents into the webapps directory manually and restart Red5.
30
66
31
67
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).
@@ -34,4 +70,4 @@ After deploy is complete, go to http://localhost:5080/chat/ in your browser (ope
34
70
35
71
You can find [compiled artifacts via Maven](http://mvnrepository.com/artifact/org.red5.demos/chat)
0 commit comments