Jump to content

websockets and performance


Recommended Posts

First off - should I ask websocket questions in this forum or in the developer forum?  If this is the wrong place then please feel free to move this post and accept my apologies.


So I've been working quite a bit with websockets lately - purely for my own personal webpage.  Basically whenever I open a new tab or home page in Chrome my personal page loads.  It's full of my favorite links as well as controls for lighting, security, cameras, etc.  


As soon as the page loads a socket is opened and a visual representation of all the 108 or so devices gets created.  Everything was great but as of this moment I've been away from home for a few days and i cannot access my ISY.  All I get is a 'system busy' message from the admin console.  It's running - I know that - as scheduled events are taking place - but I cannot access the admin console nor can I get the status of devices through the socket.  The REST interface is not responding either.  It's just gone non-responsive and needs to be rebooted which I'll have to do when I get home tomorrow.


I have no way of rebooting it but I suspect that I've oversubscribed the websocket system or perhaps I have too many browser tabs open with a subscription. Is this possible?


If oversubscribing it *is* a thing then what would be an appropriate workaround?  Only opening the socket upon request?  Closing it when the tab loses focus?  Timing it out?  All these would work but will they release the resources that the ISY commits to the socket when I close them  ie when I issue websocket.close() will this be enough for ISY or is there a *preferred* way to release the socket.


Clearly opening a socket everytime the page loads is NOT going to be a good longterm strategy.


Apparently closing a tab does NOT close the socket connection - (read this on stackoverflowcom).  I find that odd because the socket instance no longer exists so it can't be addressed.  Is there a server side - ie ISY side - way to close a socket that's left open or to close them when there are multiple sockets from the same IP?


Thanks in advance,



Link to comment

I didn' realize I could see that...


It shows this 


<Sub isExpired="yes" isPortal="no" sid="-1" sock="-1" isReusingSocket="no" isConnecting="no"/>
<Sub isExpired="yes" isPortal="no" sid="-1" sock="-1" isReusingSocket="no" isConnecting="no"/>
<Sub isExpired="yes" isPortal="no" sid="-1" sock="-1" isReusingSocket="no" isConnecting="no"/>
<Sub isExpired="yes" isPortal="no" sid="-1" sock="-1" isReusingSocket="no" isConnecting="no"/>
<Sub isExpired="no" isPortal="no" sid="48" sock="28" isReusingSocket="yes" isConnecting="no"/>
<Sub isExpired="yes" isPortal="no" sid="-1" sock="-1" isReusingSocket="no" isConnecting="no"/>
<Sub isExpired="yes" isPortal="no" sid="-1" sock="-1" isReusingSocket="no" isConnecting="no"/>
<Sub isExpired="no" isPortal="no" sid="51" sock="25" isReusingSocket="yes" isConnecting="no"/>
<Sub isExpired="yes" isPortal="no" sid="-1" sock="-1" isReusingSocket="no" isConnecting="no"/>
<Sub isExpired="yes" isPortal="no" sid="-1" sock="-1" isReusingSocket="no" isConnecting="no"/>
and actually some of my rest calls are working now too.  I'm going to check if the socket is connecting.
[edit] no websocket connection and still can't connect to admin console (system busy).  I'm connecting ssh to home
Link to comment

k.. so I've searched the documentation but can't find what some of this stuff means.  I see there are 10 entries and 10 is the number of websockets allowed so I imagine there's one entry per available socket.  


first... isExpired.  Is this time based?  or inactivity based?   What causes a socket to expire?

isPortal I suspect indicates if this socket is used for ISY Portal.  Is this significant to anything other than internally for ISY?

sid appears to be a socket ID where -1 indicates unused?  Otherwise the ID's increment as sockets are opened

sock is some other socket ID?

isReusingSocket?   Is this where one browser shares a socket between multiple tabs but with different socket IDs?



Sorry for all the questions - I can't find any docs for this




Link to comment

I think at this point, Michel is going to have to comment. I seem to remember there was a way to kill subscriptions as well - if that's the problem. But how long they stick around in an 'Expired' state I don't know.


Architecturally, there may be an issue with establishing a subscription on each tab.... Probably best to avoid that! I've never really dug into it..


Reusing the socket is from the SOAP subscriptions.... I don't think it's used at all for websocket connections.

Link to comment

Hi Mark,


isExpired = either the client unsubscribed or ISY forced the unsubscribe because it didn't get a heartbeat from the client. In short, isExpired means that the subscription can be reused. When yes, it means that this subscription is active

iPortal = whether or not this is a portal subscription such as those from ISY Portal or MobiLinc Portal

sid = Subscription ID (not socket id) ... this is what you get back from ISY when you subscribe

sock = the socket #

isReusingSocket = whether or the subscription command socket is the same socket on which the event are published. For Admin Console and websockets, this is "yes"

isConnecting = in case you provide a reportURL, isConnecting means whether or not ISY is trying to connect to the end point



If you have access to REST, then you might want to check your error log.


With kind regards,


Link to comment

Thanks Michael and Michel (lol - being a Canadian that's funny to me - you have the same name but one of you gets an 'eh?')


Michel, two questions...


how long is the heartbeat period before the socket expires?  

Is there an ip address associated with the socket so as to know what device is subscribed?


I'll check my error log tonight when I get back and see what the problem was.



Link to comment

I'll look more closely at the heartbeat event.  I see it come in via the websocket but I haven't parsed it to see its significance.


I was looking to see if an IP was associated with it so that I could tell which PC the socket was connected to.  There are some 14 pcs, laptops, ipads and android tablets around the house - I was hoping to see which machine(s) were connected. 



Link to comment


This topic is now archived and is closed to further replies.

  • Create New...