Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check for websocket connections?

Some websites use websockets. How is it possible to check what socket connections are open and on what ports they are open?

I basically wants to browse to a website and be able to monitor which websocket connections it opens.

Should I use a sniffer program for this such as fiddler or can I use Chrome or Firefox developer tools for this?

like image 948
Kasper Hansen Avatar asked Sep 23 '14 11:09

Kasper Hansen


People also ask

How do you check if WebSocket client is connected?

You can check if a WebSocket is connected by doing either of the following: Specifying a function to the WebSocket. onopen event handler property, or; Using addEventListener to listen to the open event.

How do I know if Websockets are enabled?

config in the From text box. Select system. webServer/webSocket in the Section text box. Set enabled to True to enable webSocket or False to disable webSocket.


1 Answers

If you don't need to automate the websocket inspection (i.e. doing it "by hand", one website by one, with your own browser) :

You can open the Chrome console (CTRL+SHIFT+J) then under the network tab you'll find the websockets currently opened and you'll be able to see the frames that have been exchanged with the server.


But it's not clear if you want to do that by yourself with your browser or if you want to automate the process to automatically scan some websites to look for websocket usage (i.e. using a script) ?

If so, maybe you should take a look at the Chrome driver or even a testing framework like geb (or Selenium, Cucumber, ...).

like image 94
Javier92 Avatar answered Oct 08 '22 03:10

Javier92