I am trying to establish socket communication in chrome extension. I have my extension which would be communicating with "Simple Websocket Client" provided by chrome. But I am not able to establish connection successfully using "WebSocket" class.

I tried using Socket class but later found that it is not supported for extensions. Hence I tried websocket but I am getting error as "Error during websocket handshake : ERR\_INVALID\_HTTP\_RESPONSE."

```
var wsoc;
wsoc = new WebSocket("ws://localhost:8001");
wsoc.onopen = function()
{
    wsoc.send("Message from chrome extension");
};

```

I want to see connection successfully established via below client provided by Chrome : Simple WebSocket Client Extension ( <https://chrome.google.com/webstore/detail/simple-websocket-client/pfdhoblngboilpfeibdedpjgfnlcodoo?hl=en> )