1

I should build a small and simple distributed (or rather networked) web application where the nodes could send messages directly with each other. I have no clue how to approach this though. I know how to build a simple distributed application by socket programming and desktop UI and also I know how to make a simple should I say conventional Server - Client web app, but to make a distributed web app by using web technologies ... well I have no clue.

The idea is to have a small system with at least one server and 3+ client nodes. Client nodes should be able to exchange messages with each others and also with the server. Clients has to be able to show the exchanged messages on browser. I've read tutorials, guides and even some somewhat related questions from here about how to possibly do this, but I'm not just getting it. I don't really even know where to start from.

Should I try to use Django and AJAX? Well with them, I'm again stuck with the idea that the traffic is between the server and client only, not between the clients too.

I've been stuck with this for a week now and I'm getting quite desperate. Any hints of what to do? Any help is greatly appreciated.

Thanks.

4
  • BTW, seeing how there are many chat servers available, any chance this is a homework exercise? Commented Sep 15, 2012 at 17:17
  • This is homework exercise, that's why there's the homework tag ( That seemed to be dropped off :) I added it back now. Commented Sep 16, 2012 at 17:07
  • @zaplec: As discussed here and in the tag description, the homework tag is in the process of being removed from StackOverflow and should not be added to questions. Commented Sep 16, 2012 at 17:13
  • @DavidRobinson Good to know that. Didn't know about it until now. Commented Sep 16, 2012 at 17:44

3 Answers 3

2

You could use zeroMQ.

Is a high-performance asynchronous messaging library aimed at use in scalable distributed or concurrent applications. It provides a message queue, but unlike message-oriented middleware, a ØMQ system can run without a dedicated message broker. The library is designed to have a familiar socket-style API.

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

Comments

1

asyncoro, a Python framework for asynchronous, concurrent, distributed, network programming, supports message passing and channels for easy peer-to-peer communication. If necessary, you can also use sockets for exchanging messages. Files 'remote_coro_*.py' and 'remote_channel_*.py' in examples directory should help you start.

Disclaimer: I developed asyncoro.

Comments

1

Basically you should setup your server listen for incoming client connections. Then when it receives a message from one of the clients, it should send the messages to all connected clients.

The hard part is that you need to maintain open connections to each of the clients. If you use a web application framework like Django, this is somewhat complicated.

You could also program the server yourself. It conceptually cleaner than using Django or Ajax and a good learning exercise. Use the python SocketServer library. The examples from that library already contain a chat client and server.

Alternatively, you can try it using the Tornado webserver and websockets. Tornado is a high performance asynchronous webserver. Websockets are fairly new javascript functionality that allow you to keep a permanent connection open from the server to the client.

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.