{"id":21721043,"url":"https://github.com/blimpllc/django-websocket-request","last_synced_at":"2026-03-10T18:03:27.014Z","repository":{"id":13516431,"uuid":"16207494","full_name":"blimpllc/django-websocket-request","owner":"blimpllc","description":"Support for Django's request/response lifecycle to automatically handle WebSocket messages.","archived":false,"fork":false,"pushed_at":"2014-09-23T20:39:24.000Z","size":187,"stargazers_count":179,"open_issues_count":1,"forks_count":9,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-12-15T11:05:10.042Z","etag":null,"topics":[],"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/blimpllc.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-01-24T14:57:03.000Z","updated_at":"2025-11-26T09:49:45.000Z","dependencies_parsed_at":"2022-09-02T18:23:09.598Z","dependency_job_id":null,"html_url":"https://github.com/blimpllc/django-websocket-request","commit_stats":null,"previous_names":["blimpio/django-websocket-request","getblimp/django-websocket-request","blimpllc/django-websocket-request"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/blimpllc/django-websocket-request","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blimpllc%2Fdjango-websocket-request","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blimpllc%2Fdjango-websocket-request/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blimpllc%2Fdjango-websocket-request/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blimpllc%2Fdjango-websocket-request/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blimpllc","download_url":"https://codeload.github.com/blimpllc/django-websocket-request/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blimpllc%2Fdjango-websocket-request/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30346483,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":"2024-11-26T02:03:20.927Z","updated_at":"2026-03-10T18:03:26.983Z","avatar_url":"https://github.com/blimpllc.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# django-websocket-request\n\n[![Build Status](https://travis-ci.org/GetBlimp/django-websocket-request.png?branch=master)](https://travis-ci.org/GetBlimp/django-websocket-request) [![PyPI version](https://badge.fury.io/py/django-websocket-request.png)](http://badge.fury.io/py/django-websocket-request)\n\n## Overview\nThis package provides support for transport agnostic routing to allow the Django's request/response lifecycle to automatically WebSocket messages. It borrows a WebSocket message format from [Sails.js](http://sailsjs.org/).\n\n**Note**: This is more of an experiment than anything else. We are not using this in any projects. This has a huge limitation, sending messages on events initiated by the server is not possible, so you're only able to do one way communication from the browser to the server.\n\n## Installation\n\nInstall using `pip`...\n\n```\n$ pip install django-websocket-request\n```\n\n## Usage\n\n### ws.py\n\n```python\n# Set Django Environment\nos.environ['DJANGO_SETTINGS_MODULE'] = 'django_project.settings'\n\nfrom wsrequest import WebSocketRequest\n\nmessage = '{\"method\": \"GET\", \"url\": \"/api/projects/\"}'\nrequest = WebSocketRequest(message)\nresponse = request.get_response()\n\nprint(response.content)\n\n```\n\n### WebSocket message format\n\nThe method key can be any HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD, or OPTIONS. The url key is an absolute URL without the domain name. The data key is an optional dictionary in which the key-value pairs in used to create the method’s data payload. The token key is also optional, and used to recreate an HTTP Authorization header, Authorization: JWT YOUR_TOKEN_HERE. If you're using Django REST framework, you might like to check out [django-rest-framework-jwt](https://github.com/GetBlimp/django-rest-framework-jwt).\n\n```json\n{\n  \"method\": \"POST\",\n  \"url\": \"/api/companies/\",\n  \"data\": {\n    \"name\": \"Acme Inc.\"\n  },\n  \"token\": \"MY_JSON_WEB_TOKEN\"\n}\n```\n\n## Live Demo\n\nCheck out [GetBlimp/django-websocket-request-example](https://github.com/GetBlimp/django-websocket-request-example) for an example implementation and a live demo.\n\n## Example implementation with sockjs + tornado\n```python\nimport os\nimport json\n\nfrom tornado import web, ioloop\nfrom sockjs.tornado import SockJSRouter, SockJSConnection\n\n# Set Django Environment\nos.environ['DJANGO_SETTINGS_MODULE'] = 'django_project.settings'\n\nfrom wsrequest import WebSocketRequest\n\n\nclass RESTAPIConnection(SockJSConnection):\n    def on_open(self, info):\n        self.send(json.dumps({'connected': True}))\n\n    def on_message(self, data):\n        response = WebSocketRequest(data).get_response()\n        self.send(response.content)\n\n\nif __name__ == '__main__':\n    import logging\n\n    port = 8080\n\n    logging.getLogger().setLevel(logging.INFO)\n\n    Router = SockJSRouter(RESTAPIConnection, '/ws/api')\n\n    app = web.Application(Router.urls)\n    app.listen(port)\n\n    logging.info(\" [*] Listening on 0.0.0.0:{}\".format(port))\n\n    ioloop.IOLoop.instance().start()\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblimpllc%2Fdjango-websocket-request","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblimpllc%2Fdjango-websocket-request","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblimpllc%2Fdjango-websocket-request/lists"}