Ask coding questions

← Back to all posts
How to use sockets with repl?
Berserkware

How do I make it so I can put my python chatroom server on replit and access it from my client script on my network?

Answered by KeaganLandfried [earned 5 cycles]
View Answer
Voters
Berserkware
Comments
hotnewtop
KeaganLandfried

I would suggest reading the docs at
https://python-socketio.readthedocs.io/en/latest/
Or by following a tutorial like this one...
https://pythonprogramming.net/server-chatroom-sockets-tutorial-python-3/

Please mark this as the answer if I answered your question :)

MocaCDeveloper

@KeaganLandfried

please do not add that at the end of your answer

Asking for cycles gets you nowhere and will most likely not get your answer accepted. Just post the answer, and if they find it helpful, they will check it as correct.

Also, since repl is a virtual linux machine, it does not have any sort of native support for host/client type applications, which is why most chat-based applications are written with websockets using flask or django(or good ol' javascript).

KeaganLandfried

@MocaCDeveloper
I'll add it on the end of my answer if I want, thanks m8
I've seen socket.io work in repl.it before, although I haven't done it personally. Just the other day I was using one native on replit. But again another approach may be easier.

MocaCDeveloper

I've always had trouble working with sockets on repl.

In fact, I do not think it is possible unless you use the flask module. Perhaps you could create a web-based chat application. If I do remember correctly, flask supports websockets.

You can find more information here