- Notifications
You must be signed in to change notification settings - Fork13
Channelstream is a websocket communication server for web applications
License
Channelstream/channelstream
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This is a websocket-based real-time communication server,your applications communicate with it via simple JSON REST API.
Visithttp://channelstream.org for more information.
Use from docker:
docker pull channelstream/channelstream:latestdocker run --rm -p 8000:8000 -e CHANNELSTREAM_ALLOW_POSTING_FROM=0.0.0.0 channelstream/channelstream:latestObtain source from github and do:
YOUR_PYTHON_ENV/bin/pip install channelstreamGenerate new configuration:
YOUR_PYTHON_ENV/bin/channelstream_utils make_config -o config.iniStart the server:
YOUR_PYTHON_ENV/bin/channelstream -i config.iniDemo applications live inhttps://github.com/Channelstream/channelstream_demos repository.
They show common patterns used in real-time applications.
Channelstream provides API explorer that you can use to interact with variousendpoints, it is available by default underhttp://127.0.0.1:8000/api-explorer.
To send information client interacts only with your normal www application.Your app handled authentication and processing messages from client, then passedthem as signed message to channelstream server for broadcast.
websocket client -> webapp (security and transformation happens here) -> REST call to socket server -> broadcast to other clients
This model is easy to implement, secure, easy to scale and allows all kind oflanguages/apps/work queues to interact with socket server.
All messages need to be signed with a HMAC of destination endpoint ::
import requestsfrom itsdangerous import TimestampSignersigner = TimestampSigner(SERVER_SECRET)sig_for_server = signer.sign('/connect')secret_headers = {'x-channelstream-secret': sig_for_server, 'Content-Type': 'application/json'}response = requests.post(url, data=json.dumps(payload), headers=secret_headers).json()Please consult API Explorer (http://127.0.0.1:8000/api-explorer) for in depth informationabout endpoints.
Some examples:
- /connectPOST connects users to the server
- /subscribePOST Subscribes connection to new channels
- /unsubscribePOST Removes connection from channels
- /user_statePOST set the state of specific user
- /messagePOST Send message to channels and/or users
- /messageDELETE Delete message from history and emit changes
- /messagePATCH Edit existing message in history and emit changes
- /channel_configPOST Set channel configuration
- /infoPOST Returns channel information
Client API
- /wsGET Handles websocket connections
- /listenGET Handles long polling connections
- /disconnectGET Permanently remove connection from server
- /disconnectPOST Permanently remove connection from server
Admin API
- /admin/admin.jsonGET Return server information in json format for admin panel purposes
- /admin/admin.jsonPOST Return server information in json format for admin panel purposes
Responses to client are in form oflist containingobjects:
examples:
new message ::
{"date": "2011-09-15T11:36:18.471862","message": MSG_PAYLOAD,"type": "message","user": "NAME_OF_POSTER","channel": "CHAN_NAME"}presence info ::
{"date": "2011-09-15T11:43:47.434905","message": {"action":"joined/parted"},"type": "presence","user": "NAME_OF_POSTER","channel": "CHAN_NAME"}Currently following message types are emited:message,message:edit,message:delete,presence,user_state_change.
About
Channelstream is a websocket communication server for web applications
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.