Dear Pako,
During the day I have now performed what we maybe can call a "small stress test". I did connect several websocket clients to the websocket server (I think something like

- 5 clients i the same PC using Firefox
- 1 client using Chrome
- 2 tablets, android, each using Firefox
Result with Webserver:
1) Whatever I try, I get a lot of disconnects all the time when I start to use a more javascript heavy page. My browsers did reconnect but after not very long, disconnections came again and it started all over again and again
2) I have a feeling that a simpler html page will 'survive' longer, i.e the connection will live longer than if you have rather complex javascript code in the page (like I have)
3) I also had two crashes in the Webserver plugin and I just roughly changed the code in two places to be able to continue
At line 3764
Reason for the change was that I received an exception when deletion was tried on a client that was already deleted
Code: Select all
def BroadcastMessage(self, message):
tmp = list(self.wsClients.iteritems())
for key, client in tmp:
try:
client.write_message(message)
except Exception, exc:
if exc.args[0] in (10053, 10054, 10060):
try:
del self.wsClients[client]
del self.wsClientsTime[client]
eg.PrintNotice(self.text.forcDel % repr(client))
self.TriggerEvent(
self.text.wsClientDisconn,
payload = [client]
)
except:
pass
else:
eg.PrintTraceback() # debugging ...
At line 3764
Reason for the change was that it can happen that the client connection is already gone and if so the write_message will raise an exception
Code: Select all
def write_message(self, message):
try:
self.request.send(chr(129))
length = len(message)
if length <= 125:
self.request.send(chr(length))
elif length >= 126 and length <= 65535:
self.request.send(chr(126))
self.request.send(pack(">H", length))
else:
self.request.send(chr(127))
self.request.send(pack(">Q", length))
self.request.send(message)
except:
pass
4) In my environment, with the web page I need, I could not find any solution to make it work without causing so many disconnects. I have no further ideas what could be improved/modified.
Result with Tornado:
1) The number of disconnects are very rare even if they do also happens
2) No further changes needed as I see it, the Tornado plugin is working fine
3) I have to use Tornado in my environment due to the fewer disconnects it creates
My best regards,
Walter