-
Notifications
You must be signed in to change notification settings - Fork 1k
FAQ
I'm not the developer, but AFAIK, you'd be limited by the Server's RAM. Every opened connection would fork a process. So, if you're writing your server in e.g. C, this could be quite small. If you're using something like Perl (as i am), or PHP, this oculd be around 5MB to 10MB.
Not the developer, but it should be absolutely minimal, once the connection is established. The initial connection might take some milliseconds, because websocketd will have to fork of a process and start your server process.
You can use escape codes. Since you'll most likely be sending from Javascript, you can either wrap your output with JSON.stringify("first line\nsecond line")
or escape("first line\nsecond line")
. In your application code, you'll need to JSON.parse(msg)
or unescape(msg)
respectively upon receiving a message.
I've tried catching HUP, TERM and INT, and none of them seem to be sent to my program when I disconnect the websocket. But I have to do some clean-up before exiting, so what can I do?
- The answer was simpler than I thought: websocketd simply closes STDIN, so the while () loop ends, and the program simply exits.
I connected to the websocket, and put my phone in airplane mode. The browser detects this immediately and shows an unclean disconnect, but my server program just lingers on. Implementing some last-time-I-received-data scheme would be trivial, but I am wondering if there's some inactivity timeout built-in?
- and the instant I submitted this last paragraph, I actually did get a timeout. After 17 minutes.
The websocketd user guide is a publicly editable wiki. Please contribute!
Getting Started
Reference
Language specific
Advanced: Internals
Spanish Websocket Wiki
Primeros pasos
Referencia
Lenguajes
Avanzado