Logging In

All WebSocket connections must be authenticated. The Web Server has a login as part of its functionality. The WebSockets use that login state since the WebSockets is part of the web server. If the login was handled separately we would see a double login. One login to load the html and another to access the websocket connection.

So, if a WebSocket connection is initialized from a page that was fetched from the protected area in the web server and the user logged in, then the WebSocket GET response will contain an AUTH cookie

If an additional login is required then the WebSocket connection will return a 401 Unauthorized response. The JnrWebsocket library will attempt to log in with the default credentials. If you do not want that to happen then please change the default credentials. That is strongly recommended anyway.  You can also remove the default credentials from the javascript library by issuing the setCredentials(username, password) method.  Calling this method and providing undefined for either or both arguments with disable the use of the default login.

    jnrwebsocket.setCredentials(undefined, undefined);

The OnLoggedIn listener is where you should do any initial work that you want to get done when the connection is established. For example, if you want to read some registry keys when the page loads, you will do it when the JnrWebsocket gets authenticated. The reads would fail if you tried to perform them before the connection has authenticated.

By | Updated On February 26, 2024 2:57 pm | No Comments | Categories: | Tags:


INTEG Process Group, inc. © 2023

Real-Time
Mon - Fri, 8am - 4pm EST
P: 724-933-9350
PureChat
Always Available
Contact Form
sales@integpg.com
support@integpg.com

@integpg
@jniordev
13143