All Projects → aio-libs → Sockjs

aio-libs / Sockjs

Licence: apache-2.0
SockJS Server

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Sockjs

Bolt Python
A framework to build Slack apps using Python
Stars: ✭ 190 (+80.95%)
Mutual labels:  asyncio, aiohttp, websockets
stream video server
demonstrates how to create video streaming server with the help of aiohttp and opencv
Stars: ✭ 15 (-85.71%)
Mutual labels:  websockets, aiohttp, asyncio
Python Slack Sdk
Slack Developer Kit for Python
Stars: ✭ 3,307 (+3049.52%)
Mutual labels:  asyncio, aiohttp, websockets
Aiomixcloud
Mixcloud API wrapper for Python and Async IO
Stars: ✭ 23 (-78.1%)
Mutual labels:  asyncio, aiohttp
Aioauth
Asynchronous OAuth 2.0 framework and provider for Python 3
Stars: ✭ 102 (-2.86%)
Mutual labels:  asyncio, aiohttp
Aiobotocore
asyncio support for botocore library using aiohttp
Stars: ✭ 630 (+500%)
Mutual labels:  asyncio, aiohttp
Sanic Ms
基于sanic的微服务基础架构
Stars: ✭ 336 (+220%)
Mutual labels:  asyncio, aiohttp
Rororo
Implement aiohttp.web OpenAPI 3 server applications with schema first approach.
Stars: ✭ 95 (-9.52%)
Mutual labels:  asyncio, aiohttp
Aioslacker
slacker wrapper for asyncio
Stars: ✭ 23 (-78.1%)
Mutual labels:  asyncio, aiohttp
Heroku Aiohttp Web
A project starter template for deploying an aiohttp app to Heroku
Stars: ✭ 14 (-86.67%)
Mutual labels:  asyncio, aiohttp
Ruia
Async Python 3.6+ web scraping micro-framework based on asyncio
Stars: ✭ 1,366 (+1200.95%)
Mutual labels:  asyncio, aiohttp
Aiohttp Demos
Demos for aiohttp project
Stars: ✭ 517 (+392.38%)
Mutual labels:  asyncio, aiohttp
Aiojobs
Jobs scheduler for managing background task (asyncio)
Stars: ✭ 492 (+368.57%)
Mutual labels:  asyncio, aiohttp
Cryptofeed
Cryptocurrency Exchange Websocket Data Feed Handler
Stars: ✭ 643 (+512.38%)
Mutual labels:  asyncio, websockets
Django Private Chat
Django one-to-one Websocket-based Asyncio-handled chat, developed by Bearle team
Stars: ✭ 376 (+258.1%)
Mutual labels:  asyncio, websockets
V3n0m Scanner
Popular Pentesting scanner in Python3.6 for SQLi/XSS/LFI/RFI and other Vulns
Stars: ✭ 847 (+706.67%)
Mutual labels:  asyncio, aiohttp
Socketshark
A WebSocket message router based on Python/Redis/asyncio
Stars: ✭ 51 (-51.43%)
Mutual labels:  asyncio, websockets
Postgresql2websocket
Send PostgreSQL notifications over websockets
Stars: ✭ 58 (-44.76%)
Mutual labels:  aiohttp, websockets
Python Dependency Injector
Dependency injection framework for Python
Stars: ✭ 1,203 (+1045.71%)
Mutual labels:  asyncio, aiohttp
Diy Async Web Framework
Learn how modern async web frameworks work, by writing simple clone from scratch
Stars: ✭ 309 (+194.29%)
Mutual labels:  asyncio, aiohttp

SockJS server based on Asyncio (PEP 3156)

.. image :: https://secure.travis-ci.org/aio-libs/sockjs.svg :target: https://secure.travis-ci.org/aio-libs/sockjs

sockjs is a SockJS <http://sockjs.org>_ integration for aiohttp <https://github.com/aio-libs/aiohttp/>_. SockJS interface is implemented as a aiohttp route. Its possible to create any number of different sockjs routes, ie /sockjs/* or /mycustom-sockjs/*. You can provide different session implementation and management for each sockjs route.

Simple aiohttp web server is required::

[server:main] use = egg:gunicorn#main host = 0.0.0.0 port = 8080 worker = aiohttp.worker.GunicornWebWorker

Example of sockjs route::

def main(global_settings, **settings): app = web.Application(loop=loop) app.router.add_route('GET', '/', index) sockjs.add_endpoint(app, prefix='/sockjs', handler=chatSession)

   handler = app.make_handler()
   srv = loop.run_until_complete(
       loop.create_server(handler, '127.0.0.1', 8080))
   print("Server started at http://127.0.0.1:8080")
   try:
       loop.run_forever()
    except KeyboardInterrupt:
       srv.close()
       loop.run_until_complete(handler.finish_connections())

Client side code::

<script src="//cdn.jsdelivr.net/sockjs/0.3.4/sockjs.min.js"></script> <script> var sock = new SockJS('http://localhost:8080/sockjs'); sock.onopen = function() { console.log('open'); }; sock.onmessage = function(obj) { console.log(obj); }; sock.onclose = function() { console.log('close'); }; </script>

Supported transports

  • websocket hybi-10 <http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-10>_
  • xhr-streaming <https://secure.wikimedia.org/wikipedia/en/wiki/XMLHttpRequest#Cross-domain_requests>_
  • xhr-polling <https://secure.wikimedia.org/wikipedia/en/wiki/XMLHttpRequest#Cross-domain_requests>_
  • iframe-xhr-polling <https://developer.mozilla.org/en/DOM/window.postMessage>_
  • iframe-eventsource (EventSource <http://dev.w3.org/html5/eventsource/>_ used from an iframe via postMessage <https://developer.mozilla.org/en/DOM/window.postMessage>_)
  • iframe-htmlfile (HtmlFile <http://cometdaily.com/2007/11/18/ie-activexhtmlfile-transport-part-ii/>_ used from an iframe via postMessage.
  • jsonp-polling <https://secure.wikimedia.org/wikipedia/en/wiki/JSONP>_

Requirements

Examples

You can find several examples in the sockjs repository at github.

https://github.com/aio-libs/sockjs/tree/master/examples

License

sockjs is offered under the Apache 2 license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].