Ask coding questions

← Back to all posts
How do you host a server on replit?
nt998302 (179)

I was playing around with socket.io in python, and I was able to make a server, but I have no clue how to connect to it. Any help?

Answered by a5rocks (788) [earned 5 cycles]
View Answer
Commentshotnewtop
a5rocks (788)

That's not socket.io... By the way, only http requests can get to your repl, so this won't be possible, so you need to use something like websockets or aforementioned socket.io (though I can't to find how to do a socket.io server in python)

nt998302 (179)

@a5rocks I kind of see. There's not much about websockets online. I'm still unsure how to host a server on replit.

nt998302 (179)

@a5rocks Is socket just for creating sockets and not servers?

a5rocks (788)

@nt998302 Yeah, socket is probably too low level for you to build anything decent on, I would recommend reading though: https://websockets.readthedocs.io/en/stable/

nt998302 (179)

@a5rocks Ok. Do you know how to host a server with replit tho? I see people hosting their servers via link with node js. Not sure how to set one up tho.

a5rocks (788)

@nt998302 Well, you use socket.io in node, or even websockets in python should set the server up. Though if you want to be able to look at the pages in python I would recommend "Flask" (there's a couple tutorials in the Learn board)

nt998302 (179)

@a5rocks Sounds good. Thanks for the help! :)