{"id":38897779,"url":"https://github.com/dorneanu/pytcp2ws","last_synced_at":"2026-01-17T15:00:49.742Z","repository":{"id":14686392,"uuid":"17405977","full_name":"dorneanu/pyTCP2WS","owner":"dorneanu","description":"Creates a bridge between TCP sockets and WebSockets using JSON data","archived":false,"fork":false,"pushed_at":"2014-03-04T15:46:22.000Z","size":120,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-18T00:13:25.962Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dorneanu.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-03-04T15:03:07.000Z","updated_at":"2014-11-01T00:11:51.000Z","dependencies_parsed_at":"2022-09-21T15:23:22.111Z","dependency_job_id":null,"html_url":"https://github.com/dorneanu/pyTCP2WS","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dorneanu/pyTCP2WS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorneanu%2FpyTCP2WS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorneanu%2FpyTCP2WS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorneanu%2FpyTCP2WS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorneanu%2FpyTCP2WS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dorneanu","download_url":"https://codeload.github.com/dorneanu/pyTCP2WS/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dorneanu%2FpyTCP2WS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28510928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-17T15:00:26.977Z","updated_at":"2026-01-17T15:00:49.690Z","avatar_url":"https://github.com/dorneanu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Motivation\n----------\n\nDuring my [D3](http://d3js.org/) experiments  I wanted to capture data from the command line and send it to my D3 application. Of course I could have read the data from some CSV,JSON file but that wasn't \"real-time\" enough. So I had a \n\n* data source\n* D3 code applying some magic to the data \n\nThe *data source* in that case were some grep lines transformed to JSON data. In fact I was missing the linking part between mentioned components.  \n\nBasic idea\n------\n\n*pyTCP2WS* listens for some data on a **TCP** socket and passes it through some **WebSocket**. At the moment only JSON data is supported.\n\nIn order to transfer data from one socket to the another a (deadlock free) queue is being used (producer and consumer pattern).\n\n\nRun me\n-------\n\nThese are the basic parameters:\n\n    $ python3 pyTCP2WS.py --help\n\tusage: pyTCP2WS.py [-h] [--tcp-port TCP_PORT] [--ws-port WS_PORT]\n\t                   [--host HOST]\n\n\tSend your data from TCP socket to WebSocket using JSON\n\n\toptional arguments:\n\t  -h, --help           show this help message and exit\n\t  --tcp-port TCP_PORT  Specify TCP port to listen for JSON packets\n\t  --ws-port WS_PORT    Specify WebSocket port to send JSON data to\n\t  --host HOST          Specify host to bind socket on\n\nIn order to start a TCP socket to pass-through your JSON data to your web socket, run:\n\n\t$ python3 pyTCP2WS.py --tcp-port 8081 --ws-port 8080 \n\t2014-03-04 18:14:19,245 - INFO - [TCPServer] - Listening on 8081\n\t2014-03-04 18:14:19,247 - INFO - [HTTPServer] - Starting HTTP server on port 8080\n\t2014-03-04 18:14:19,247 - INFO - [HTTPServer] - Start collector server\n\t2014-03-04 18:14:19,247 - INFO - [HTTPServer] - Waiting for incoming data ...\n\nNow using you can send data to the TCP socket:\n\n\t$ echo '{\"value\":\"30\"}' | json | nc localhost 8081\n\nNow you should see pyTCP2WS printing some debug messages:\n\n\t...\n\t2014-03-04 18:15:39,068 - INFO - [TCPServer] - Added JSON to IN queue\n\t2014-03-04 18:15:39,068 - INFO - [HTTPServer] - Received data!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdorneanu%2Fpytcp2ws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdorneanu%2Fpytcp2ws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdorneanu%2Fpytcp2ws/lists"}