{"id":19197839,"url":"https://github.com/red5/red5-websocket","last_synced_at":"2025-09-21T17:25:15.512Z","repository":{"id":63825903,"uuid":"20274905","full_name":"Red5/red5-websocket","owner":"Red5","description":"Websocket plug-in for Red5","archived":false,"fork":false,"pushed_at":"2018-11-15T15:30:28.000Z","size":228,"stargazers_count":61,"open_issues_count":1,"forks_count":49,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-05-09T00:53:53.160Z","etag":null,"topics":["java","red5","red5-websocket","websocket-plug","websockets","ws","wss"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Red5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-28T22:48:22.000Z","updated_at":"2024-07-25T15:09:03.000Z","dependencies_parsed_at":"2022-11-27T00:28:51.866Z","dependency_job_id":null,"html_url":"https://github.com/Red5/red5-websocket","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Red5%2Fred5-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Red5%2Fred5-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Red5%2Fred5-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Red5%2Fred5-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Red5","download_url":"https://codeload.github.com/Red5/red5-websocket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253171236,"owners_count":21865289,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","red5","red5-websocket","websocket-plug","websockets","ws","wss"],"created_at":"2024-11-09T12:18:48.665Z","updated_at":"2025-09-21T17:25:10.471Z","avatar_url":"https://github.com/Red5.png","language":"Java","readme":"red5-websocket\n==============\n\nWebsocket plug-in for Red5\n\nThis plugin is meant to provide websocket functionality for applications running in red5. The code is constructed to comply with rfc6455.\n\nhttp://tools.ietf.org/html/rfc6455\n\nSpecial thanks to Takahiko Toda and Dhruv Chopra for the initial ideas and source.\n\nConfiguration\n--------------\n\nAdd the WebSocket transport to the jee-container.xml or red5.xml. If placing it in the red5.xml, ensure the bean comes after the plugin launcher entry.\n\nTo bind to one or many IP addresses and ports:\n\n```xml\n\u003cbean id=\"webSocketTransport\" class=\"org.red5.net.websocket.WebSocketTransport\"\u003e\n        \u003cproperty name=\"addresses\"\u003e\n            \u003clist\u003e\n            \t\u003cvalue\u003e192.168.1.174\u003c/value\u003e\n            \t\u003cvalue\u003e192.168.1.174:8080\u003c/value\u003e\n            \t\u003cvalue\u003e192.168.1.174:10080\u003c/value\u003e\n            \u003c/list\u003e\n        \u003c/property\u003e\n\u003c/bean\u003e\n```\n\nIf you don't want to specify the IP:\n```\n\u003cbean id=\"webSocketTransport\" class=\"org.red5.net.websocket.WebSocketTransport\"\u003e\n\t\u003cproperty name=\"port\" value=\"8080\"/\u003e\n\u003c/bean\u003e\n\n```\nTo support secure communication (wss) add this:\n\n```xml\n    \u003cbean id=\"webSocketTransportSecure\" class=\"org.red5.net.websocket.WebSocketTransport\"\u003e\n        \u003cproperty name=\"secureConfig\"\u003e\n            \u003cbean id=\"webSocketSecureConfig\" class=\"org.red5.net.websocket.SecureWebSocketConfiguration\"\u003e\n                \u003cproperty name=\"keystoreFile\" value=\"conf/keystore\"/\u003e\n                \u003cproperty name=\"keystorePassword\" value=\"password\"/\u003e\n                \u003cproperty name=\"truststoreFile\" value=\"conf/truststore\"/\u003e\n                \u003cproperty name=\"truststorePassword\" value=\"password\"/\u003e\n            \u003c/bean\u003e\n        \u003c/property\u003e\n        \u003cproperty name=\"addresses\"\u003e\n            \u003clist\u003e\n                \u003cvalue\u003e192.168.1.174:10081\u003c/value\u003e\n            \u003c/list\u003e\n        \u003c/property\u003e\n    \u003c/bean\u003e\n```\nIf you are not using unlimited strength JCE (you are outside the US), you may have to specify the cipher suites as shown below:\n```xml\n    \u003cbean id=\"webSocketTransportSecure\" class=\"org.red5.net.websocket.WebSocketTransport\"\u003e\n        \u003cproperty name=\"secureConfig\"\u003e\n            \u003cbean id=\"webSocketSecureConfig\" class=\"org.red5.net.websocket.SecureWebSocketConfiguration\"\u003e\n                \u003cproperty name=\"keystoreFile\" value=\"conf/keystore\"/\u003e\n                \u003cproperty name=\"keystorePassword\" value=\"password\"/\u003e\n                \u003cproperty name=\"truststoreFile\" value=\"conf/truststore\"/\u003e\n                \u003cproperty name=\"truststorePassword\" value=\"password\"/\u003e\n                \u003cproperty name=\"cipherSuites\"\u003e\n                    \u003carray\u003e\n                        \u003cvalue\u003eTLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\u003c/value\u003e\n                        \u003cvalue\u003eTLS_ECDHE_RSA_WITH_AES_128_CBC_SHA\u003c/value\u003e\n                        \u003cvalue\u003eTLS_ECDHE_RSA_WITH_RC4_128_SHA\u003c/value\u003e\n                        \u003cvalue\u003eTLS_RSA_WITH_AES_128_CBC_SHA256\u003c/value\u003e\n                        \u003cvalue\u003eTLS_RSA_WITH_AES_128_CBC_SHA\u003c/value\u003e\n                        \u003cvalue\u003eSSL_RSA_WITH_RC4_128_SHA\u003c/value\u003e\n                    \u003c/array\u003e\n                \u003c/property\u003e\n                \u003cproperty name=\"protocols\"\u003e\n                    \u003carray\u003e\n                        \u003cvalue\u003eTLSv1\u003c/value\u003e\n                        \u003cvalue\u003eTLSv1.1\u003c/value\u003e\n                        \u003cvalue\u003eTLSv1.2\u003c/value\u003e\n                    \u003c/array\u003e\n                \u003c/property\u003e\n            \u003c/bean\u003e\n        \u003c/property\u003e\n        \u003cproperty name=\"addresses\"\u003e\n            \u003clist\u003e\n                \u003cvalue\u003e192.168.1.174:10081\u003c/value\u003e\n            \u003c/list\u003e\n        \u003c/property\u003e\n    \u003c/bean\u003e\n\n```\n\n\nAdding WebSocket to an Application\n------------------------\n\nTo enable websocket support in your application, add this to your appStart() method:\n\n```\n  WebSocketScopeManager manager = ((WebSocketPlugin) PluginRegistry.getPlugin(\"WebSocketPlugin\")).getManager(scope);\n  manager.setApplication(this);\n```\n\nFor clean-up add this to appStop():\n\n```\n  WebSocketScopeManager manager = ((WebSocketPlugin) PluginRegistry.getPlugin(\"WebSocketPlugin\")).getManager(scope);\n  manager.stop();\n```\n\nSecurity Features\n-------------------\nSince WebSockets don't implement Same Origin Policy (SOP) nor Cross-Origin Resource Sharing (CORS), we've implemented a means to restrict access via configuration using SOP / CORS logic. To configure the security features, edit your `conf/jee-container.xml` file and locate the bean displayed below:\n```xml\n    \u003cbean id=\"webSocketTransport\" class=\"org.red5.net.websocket.WebSocketTransport\"\u003e\n        \u003cproperty name=\"addresses\"\u003e\n            \u003clist\u003e\n                \u003cvalue\u003e${ws.host}:${ws.port}\u003c/value\u003e\n            \u003c/list\u003e\n        \u003c/property\u003e\n        \u003cproperty name=\"sameOriginPolicy\" value=\"false\" /\u003e\n        \u003cproperty name=\"crossOriginPolicy\" value=\"true\" /\u003e\n        \u003cproperty name=\"allowedOrigins\"\u003e\n            \u003carray\u003e\n                \u003cvalue\u003elocalhost\u003c/value\u003e\n                \u003cvalue\u003ered5.org\u003c/value\u003e\n            \u003c/array\u003e\n        \u003c/property\u003e\n    \u003c/bean\u003e\n```\nProperties:\n * [sameOriginPolicy](https://www.w3.org/Security/wiki/Same_Origin_Policy) - Enables or disables SOP. The logic differs from standard web SOP by *NOT* enforcing protocol and port.\n * [crossOriginPolicy](https://www.w3.org/Security/wiki/CORS) - Enables or disables CORS. This option pairs with the `allowedOrigins` array.\n * allowedOrigins - The list or host names or fqdn which are to be permitted access. The default if none are specified is `*` which equates to any or all.\n \n\n\nTest Page\n-------------------\n\nReplace the wsUri variable with your applications path.\n\n```\n\u003c!DOCTYPE html\u003e  \n\u003cmeta charset=\"utf-8\" /\u003e  \n\u003ctitle\u003eWebSocket Test\u003c/title\u003e  \n\u003cscript language=\"javascript\" type=\"text/javascript\"\u003e  \nvar wsUri = \"ws://192.168.1.174:10080/myapp\"; \nvar output;  function init() { output = document.getElementById(\"output\"); testWebSocket(); }  function testWebSocket() { websocket = new WebSocket(wsUri); websocket.onopen = function(evt) { onOpen(evt) }; websocket.onclose = function(evt) { onClose(evt) }; websocket.onmessage = function(evt) { onMessage(evt) }; websocket.onerror = function(evt) { onError(evt) }; }  function onOpen(evt) { writeToScreen(\"CONNECTED\"); doSend(\"WebSocket rocks\"); }  function onClose(evt) { writeToScreen(\"DISCONNECTED\"); }  function onMessage(evt) { writeToScreen('\u003cspan style=\"color: blue;\"\u003eRESPONSE: ' + evt.data+'\u003c/span\u003e'); websocket.close(); }  function onError(evt) { writeToScreen('\u003cspan style=\"color: red;\"\u003eERROR:\u003c/span\u003e ' + evt.data); }  function doSend(message) { writeToScreen(\"SENT: \" + message);  websocket.send(message); }  function writeToScreen(message) { var pre = document.createElement(\"p\"); pre.style.wordWrap = \"break-word\"; pre.innerHTML = message; output.appendChild(pre); }  window.addEventListener(\"load\", init, false);  \u003c/script\u003e  \u003ch2\u003eWebSocket Test\u003c/h2\u003e \u003cdiv id=\"output\"\u003e\u003c/div\u003e\n```\n\nDemo application project\n----------------\nhttps://github.com/Red5/red5-websocket-chat\n\nPre-compiled JAR\n----------------\nYou can find [compiled artifacts via Maven](http://mvnrepository.com/artifact/org.red5/websocket)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fred5%2Fred5-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fred5%2Fred5-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fred5%2Fred5-websocket/lists"}