0

What is the best way to make a browser=based chat server with a python back-end?

For the reverse-AJAX type of pushing, I found autobahn and Twisted, but is there a good way to push information from one client to all other clients?

The tutorials for Twisted and Autobahn all seemed to indicate a 1-1 connection between a single python instance and a single client.

Follow-up question: Is there a way to configure apache to allow clients to connect to a web socket that is on port 80, if apache is already on port 80? So something like ws:domain/foo.py, insted of having to specify a different port.

2
  • You can't share a port between multiple apps, though you CAN use a dispatcher to handle incoming requests and hand off data as needed to whatever app should be receiving it. however, apache isn't set up for this. Commented Feb 20, 2012 at 23:36
  • Thanks, that was my suspicion. Do you know of any python method/library where I can onMessage from anyone sendMessage to everyone? Commented Feb 20, 2012 at 23:38

1 Answer 1

1

Autobahn doesn't use "reverse-AJAX" (whatever that's supposed to be ;), but WebSockets.

You can easily broadcast messages sent by clients to all connected clients using a couple of lines:

http://www.tavendo.de/autobahn/tutorial/broadcast.html https://github.com/oberstet/Autobahn/tree/master/demo/broadcast

This is pure WebSockets.

You can also do much more sophisticated stuff, general Publish & Subscribe with Autobahn using WAMP (WebSockets Application Messaging Protocol) over WebSockets which Autobahn also provides.

Please see the other tutorials on our site .

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.