{"id":18088616,"url":"https://github.com/jish/websocket-lab","last_synced_at":"2026-02-23T21:12:05.621Z","repository":{"id":28398436,"uuid":"31912730","full_name":"jish/websocket-lab","owner":"jish","description":"A lab for experimenting with websockets","archived":false,"fork":false,"pushed_at":"2015-03-09T18:17:31.000Z","size":120,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T08:17:56.251Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","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/jish.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}},"created_at":"2015-03-09T17:32:27.000Z","updated_at":"2015-03-09T18:17:31.000Z","dependencies_parsed_at":"2022-09-03T15:52:07.399Z","dependency_job_id":null,"html_url":"https://github.com/jish/websocket-lab","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jish%2Fwebsocket-lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jish%2Fwebsocket-lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jish%2Fwebsocket-lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jish%2Fwebsocket-lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jish","download_url":"https://codeload.github.com/jish/websocket-lab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247423521,"owners_count":20936626,"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":[],"created_at":"2024-10-31T17:13:54.597Z","updated_at":"2025-10-31T19:02:27.031Z","avatar_url":"https://github.com/jish.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Build a websocket echo server\n\nGo to http://websocketd.com/, scroll all the way down to the bottom of the page, and download `websocketd`.\n\n### Write a simple echo server\n\n`websocketd` writes to your program on standard input and reads whatever you write out on standard output.\n\nLet's write a simple Ruby script to echo back the message it received:\n\n```ruby\n#!/usr/bin/env ruby\n\nwhile message = STDIN.gets\n  puts \"Echo: #{message}\"\n  STDOUT.flush\nend\n```\n\n### Create an HTML page to interact with your websocket server\n\nThe `ws` protocol, just like `http` can be transfered over a secure channel, (`wss` or `https`) or an insecure channel. Since we're just creating a test server, we're going to use the `ws://` protocol. In production you'll want to use `wss://`.\n\nLet's use this example HTML page:\n\n```html\n\u003chtml\u003e\n  \u003chead\u003e\n    \u003ctitle\u003eWebsocket test\u003c/title\u003e\n  \u003c/head\u003e\n\n  \u003cbody\u003e\n    \u003ch1\u003eWebsocket test\u003c/h1\u003e\n\n    \u003cscript type=\"text/javascript\"\u003e\n      var ws = new WebSocket('ws://localhost:8080/');\n\n      ws.onmessage = function(event) {\n        console.log('Message from server: ' + event.data);\n      };\n\n      ws.onopen = function() {\n        ws.send('Hello World!');\n      }\n    \u003c/script\u003e\n  \u003c/body\u003e\n\u003c/html\u003e\n```\n\n### Start it up!\n\nLet's start our websocket server with the following command:\n\n    websocketd --staticdir=. --port=8080 ./echo_server.rb\n\nNow open your browser to http://localhost:8080/ and interact with your server in the developer console:\n\n```js\nws.send('Hello World!');\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjish%2Fwebsocket-lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjish%2Fwebsocket-lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjish%2Fwebsocket-lab/lists"}