{"id":15447829,"url":"https://github.com/geolffreym/wsserver","last_synced_at":"2026-05-01T10:31:32.767Z","repository":{"id":85046839,"uuid":"90687178","full_name":"geolffreym/wsserver","owner":"geolffreym","description":"Node websocket server","archived":false,"fork":false,"pushed_at":"2017-05-23T15:32:06.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T08:44:22.549Z","etag":null,"topics":["javascript","nodejs","protocol","real-time","syrup","websocket-server","websockets"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/geolffreym.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-09T01:09:24.000Z","updated_at":"2017-05-23T07:41:47.000Z","dependencies_parsed_at":"2023-03-07T09:00:56.118Z","dependency_job_id":null,"html_url":"https://github.com/geolffreym/wsserver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/geolffreym/wsserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geolffreym%2Fwsserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geolffreym%2Fwsserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geolffreym%2Fwsserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geolffreym%2Fwsserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geolffreym","download_url":"https://codeload.github.com/geolffreym/wsserver/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geolffreym%2Fwsserver/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32494270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["javascript","nodejs","protocol","real-time","syrup","websocket-server","websockets"],"created_at":"2024-10-01T20:20:31.308Z","updated_at":"2026-05-01T10:31:32.750Z","avatar_url":"https://github.com/geolffreym.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Websocket Server\n=========================\nSocket connection manager, protocols and administrators.\n\nUsage\n------\n\nWebsocket Usage:\n\nThe manager needs to get through a query string, the administrator, the user and the protocol.\nThis to generate a separate structure for each service provided by each protocol, you can use different protocols with different users and administrators. A tree structure is generated.\nexample: \n\n    {protocol} -\u003e  {admin}  -\u003e {client}\n                            -\u003e {client2}  \n                            -\u003e {client3}  \n                   {admin2} -\u003e {client1} \n                            -\u003e {client2} \n                           \n    {protocol2} -\u003e {admin}  -\u003e {client}\n                            -\u003e {client2}  \n                            -\u003e {client3}  \n                   {admin2} -\u003e {client1} \n                            -\u003e {client2} \n\nThis makes it much easier to manage the behavior of each service, without affecting each other. \nYou can shut down one service, keeping active the other services without problem. \n\nThe default values ​​for the protocol is 'default' for the customer is 'default' and the manager is 'temp'\n\nServer Side\n-----------\n```js\nvar _http = require('http'),\n    _wsServer = require('wsserver');\n\n/**Http Server\n * @type {*}\n * @private\n */\n_server = _http.createServer(function (request, response) {\n\n}).listen(_webServerPort, function () {\n    console.log(\"Listening on Port \" + _webServerPort);\n});\n\n\n/**wsSocket Server\n * @type {_wsServer}\n * @private\n */\n_wsServer = new _wsServer(_server);\n\n//You need to check the connections come from a valid client\n_wsServer.setMyHost('mydomain.com');\n\n//Events Handler\n_wsServer.on('message', function (message) {\n    //The native MESSAGE functions are executed automatically\n    \n    //Extra Control\n    //On receive messages what to do?\n});\n\n_wsServer.on('close', function (message) {\n       //The native CLOSE functions are executed automatically\n    \n       //Extra Control\n       //On socket close what to do?\n});\n  \n_wsServer.on('error', function (message) {\n      //The native ERROR functions are executed automatically\n    \n      //Extra Control\n      //On socket error what to do?\n});\n\n//Run Server\n_wsServer.run();\n   \n```\n\nClient Side\n----------\n\n```js    \n//Creating Connections \n\nvar _socket  = new WebSocket('ws://MY_URL'?admin=mike\u0026user=carl\u0026protocol=chat);\n\nThe administrator is validated and created, when user == admin in the server:\n\n    ?admin=mike\u0026user=mike\u0026protocol=chat\n    \nif you do not need a administrator just:\n\n    ?user=mike\u0026protocol=chat\n\n// When the connection is open, send some data to the server\n\n_socket.onopen = function () {\n        //Sending Message\n        _socket.send(JSON.stringify({\n                        to : 'carl', //Receipt\n                        protocol : 'chat', // Opened Protocol\n                        message : 'Hi' // Message\n                    })); \n};\n\n// Log errors\n_socket.onerror = function (error) {\n  console.log('WebSocket Error ' + error);\n};\n\n// Log messages from the server\n_socket.onmessage = function (e) {\n  console.log('Server: ' + e.data);\n};\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeolffreym%2Fwsserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeolffreym%2Fwsserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeolffreym%2Fwsserver/lists"}