What does it take to implement a chat system in Python (Not asking for code just advice before I start my little project)

Jorgen Grahn grahn+nntp at snipabacken.se
Fri Jul 19 07:25:27 EDT 2013


On Thu, 2013-07-18, Chris Angelico wrote:
...
> You can certainly do your server-side programming directly in Python;
> in fact, I recommend it for this task. There's no reason to use HTTP,
> much less a web framework (which usually consists of a structured way
> to build HTML pages, plus a bunch of routing and stuff, none of which
> you need). All you need is a simple structure for separating one
> message from another.

> I would recommend either going MUD/TELNET style
> and ending each message with a newline, or prefixing each message with
> its length in octets. Both ways work very nicely; newline-termination
> allows you to use a MUD client for debugging, which I find very
> convenient

It's definitely the way to go.  It's not just MUDs -- a lot of
Internet protocols work that way.  Netcat is one popular client for
talking to/debugging/testing such servers.  No doubt MUD clients too,
but last time I did such stuff was in 1993, and I think I used telnet
...

In fact, I'd design the protocol before starting to write code.  Or
better, steal some existing chat protocol.  Like a subset of IRC.


There's also another question in the original posting that bothers me:
paraphrased "do I need to learn database programming to manage users"?
No!  Unix does fine with plain-text files.

Managing credentials (understanding cryptography, setting up a support
organization for resetting lost passwords ...) is non-trivial though,
so try to do without such things at first.  It's not obvious that you
should need an account for an experimental chat, anyway.

/Jorgen

-- 
  // Jorgen Grahn <grahn@  Oo  o.   .     .
\X/     snipabacken.se>   O  o   .



More information about the Python-list mailing list