{"id":20594781,"url":"https://github.com/itraceur/sockjs-channels","last_synced_at":"2025-08-18T11:45:47.969Z","repository":{"id":57307069,"uuid":"473675502","full_name":"iTraceur/sockjs-channels","owner":"iTraceur","description":"WebSocket emulation - SockJS server implementation for Django Channels.","archived":false,"fork":false,"pushed_at":"2022-05-23T05:08:45.000Z","size":59,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-30T05:40:05.161Z","etag":null,"topics":["asgi","asyncio","channels","django","realtime-communication","realtime-web","realtime-web-application","sockjs","websocket"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iTraceur.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2022-03-24T15:57:14.000Z","updated_at":"2022-04-26T02:11:22.000Z","dependencies_parsed_at":"2022-09-04T23:13:19.559Z","dependency_job_id":null,"html_url":"https://github.com/iTraceur/sockjs-channels","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/iTraceur/sockjs-channels","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iTraceur%2Fsockjs-channels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iTraceur%2Fsockjs-channels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iTraceur%2Fsockjs-channels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iTraceur%2Fsockjs-channels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iTraceur","download_url":"https://codeload.github.com/iTraceur/sockjs-channels/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iTraceur%2Fsockjs-channels/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270988014,"owners_count":24680662,"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","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"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":["asgi","asyncio","channels","django","realtime-communication","realtime-web","realtime-web-application","sockjs","websocket"],"created_at":"2024-11-16T08:10:09.700Z","updated_at":"2025-08-18T11:45:47.884Z","avatar_url":"https://github.com/iTraceur.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SockJS-Channels\n\n`SockJS-Channels` is a server-side implementation of the [SockJS](http://sockjs.org) protocol for the [Django Channels](https://github.com/django/channels/) and was inspired by the [SockJS-aiohttp](https://github.com/aio-libs/sockjs/) project. SockJS-Channels interface is implemented as a ASGI routing, it runs inside a ASGI application rather than ASGI server. Its possible to create any number of different sockjs routings, ie `/sockjs/*` or `/chat-sockjs/*`. You can provide different session implementation and management for each sockjs routing.\n\n## Requirements\n* Python 3.6+\n* Django 3.2+\n* Channels 3.0.0+\n\n## Installation\n```bash\n$ pip install sockjs-channels\n```\n\n## ASGI Routing\nHere’s an example of `asgi.py` might looks like:\n```python\nimport os\n\nfrom channels.routing import ProtocolTypeRouter, URLRouter\nfrom django.core.asgi import get_asgi_application\nfrom django.urls import re_path\n\nfrom sockjs import make_routing\n\nos.environ.setdefault('DJANGO_SETTINGS_MODULE', 'chat.settings')\n\n# Initialize Django ASGI application early to ensure the AppRegistry\n# is populated before importing code that may import ORM models.\ndjango_asgi_app = get_asgi_application()\n\nfrom chat.views import chat_msg_handler\n\nrouting = make_routing(chat_msg_handler, name='chat')\n\n# Add django's url routing\nrouting.http.append(re_path(r'', django_asgi_app))\n\napplication = ProtocolTypeRouter({\n    'http': URLRouter([\n        *routing.http\n    ]),\n    'websocket': URLRouter([\n        *routing.websocket\n    ])\n})\n```\n\n## Supported Transports\n* websocket\n* xhr-streaming\n* xhr-polling\n* iframe-xhr-polling\n* iframe-eventsource\n* iframe-htmlfile\n* jsonp-polling\n\n## Examples\nYou can find a simple chat example in the sockjs-channels repository at github.\n\n[https://github.com/iTraceur/sockjs-channels/tree/main/examples/chat](https://github.com/iTraceur/sockjs-channels/tree/main/examples/chat)\n\n## License\nsockjs-channels is offered under the MIT license.\n\n## Test Coverage\n```\nName                                Stmts   Miss Branch BrPart  Cover\n---------------------------------------------------------------------\nsockjs/__init__.py                     15      0      0      0   100%\nsockjs/constants.py                     5      0      0      0   100%\nsockjs/exceptions.py                    3      0      6      0   100%\nsockjs/protocol.py                     36      0      0      0   100%\nsockjs/routing.py                     116     15     30     10    83%\nsockjs/session.py                     305      6    118     12    96%\nsockjs/transports/__init__.py          10      0      0      0   100%\nsockjs/transports/base.py             139     17     40      9    84%\nsockjs/transports/eventsource.py       18      0      6      1    96%\nsockjs/transports/htmlfile.py          34      0     10      1    98%\nsockjs/transports/jsonp.py             50      0     16      0   100%\nsockjs/transports/rawwebsocket.py      51      1     16      2    96%\nsockjs/transports/utils.py             26      3      6      3    81%\nsockjs/transports/websocket.py         63      2     14      1    96%\nsockjs/transports/xhr.py               15      0      4      0   100%\nsockjs/transports/xhrsend.py           29      0      8      0   100%\nsockjs/transports/xhrstreaming.py      16      0      4      0   100%\n---------------------------------------------------------------------\nTOTAL                                 931     44    278     39    93%\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitraceur%2Fsockjs-channels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitraceur%2Fsockjs-channels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitraceur%2Fsockjs-channels/lists"}