CC: Tweaked

CC: Tweaked

42M Downloads

Method to check if websocket is still open

darienac opened this issue ยท 3 comments

commented

This isn't really an issue, but it would be nice if when you create a websocket object there could be a method like ws.isAlive() to check if the connection is still alive.

commented

This isn't really an issue, but it would be nice if when you create a websocket object there could be a method like ws.isAlive() to check if the connection is still alive.

I just saw this, I would like you to impl this but we actually can just use pcall(ws.receive)

commented

I've been rather unsure of this for a while now. Decided to take the plunge, implemented it, and then became even more unsure again.

My main problem here is you shouldn't need to be checking if a websocket is open or closed. websocket_closed is the "authoritative" source of when a socket is closed, but you never know for sure if a socket is still entirely usable until you try to send something with it, so I'd rather people avoided relying on isOpen methods.

commented

I've not had any response to the previous comment, so closing this for now.