We need to call the open method by creating a WebSocket object inorder to make a WebSocket connection. How can we do that?

 Posted by Rajnilari2015 on 9/19/2015 | Category: HTML 5 Interview questions | Views: 1918 | Points: 40

First of all, there is no "open" method on the WebSocket object. However, when we want to create a WebSocket object for establishing a connection, we basically instantiate the WebSocket object that does the trick.


var uri ='ws://echo.websocket.org/';

var webSocket = new WebSocket(uri);

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response