Interview Questions

AJAX Interview Questions Android Interview Questions Angular 2 Interview Questions AngularJs Interview Questions Apache Presto Interview Questions Apache Tapestry Interview Questions Arduino Interview Questions ASP.NET MVC Interview Questions Aurelia Interview Questions AWS Interview Questions Blockchain Interview Questions Bootstrap Interview Questions C Interview Questions C Programming Coding Interview Questions C# Interview Questions C++ Interview Questions Cakephp Interview Questions Cassandra Interview Questions CherryPy Interview Questions Clojure Interview Questions Cobol Interview Questions CodeIgniter interview Questions CoffeeScript Interview Questions Cordova Interview Questions CouchDB interview questions CSS Buttons Interview Questions CSS Interview Questions D Programming Language Interview Questions Dart Programming Language Interview Questions Data structure & Algorithm Interview Questions DB2 Interview Questions DBMS Interview Questions Django Interview Questions Docker Interview Questions DOJO Interview Questions Drupal Interview Questions Electron Interview Questions Elixir Interview Questions Erlang Interview Questions ES6 Interview Questions and Answers Euphoria Interview Questions ExpressJS Interview Questions Ext Js Interview Questions F# Interview Questions Firebase Interview Questions Flask Interview Questions Flex Interview Questions Fortran Interview Questions Foundation Interview Questions Framework7 Interview Questions FuelPHP Framework Interview Questions Go Programming Language Interview Questions Google Maps Interview Questions Groovy interview Questions GWT Interview Questions Hadoop Interview Questions Haskell Interview Questions Highcharts Interview Questions HTML Interview Questions HTTP Interview Questions Ionic Interview Questions iOS Interview Questions IoT Interview Questions Java BeanUtils Interview Questions Java Collections Interview Questions Java Interview Questions Java JDBC Interview Questions Java Multithreading Interview Questions Java OOPS Interview Questions Java Programming Coding Interview Questions Java Swing Interview Questions JavaFX Interview Questions JavaScript Interview Questions JCL (Job Control Language) Interview Questions Joomla Interview Questions jQuery Interview Questions js Interview Questions JSF Interview Questions JSP Interview Questions KnockoutJS Interview Questions Koa Interview Questions Laravel Interview Questions Less Interview Questions LISP Interview Questions Magento Interview Questions MariaDB Interview Questions Material Design Lite Interview Questions Materialize CSS Framework Interview Questions MathML Interview Questions MATLAB Interview Questions Meteor Interview Questions MongoDB interview Questions Moo Tools Interview Questions MySQL Interview Questions NodeJS Interview Questions OpenStack Interview Questions Oracle DBA Interview Questions Pascal Interview Questions Perl interview questions Phalcon Framework Interview Questions PhantomJS Interview Questions PhoneGap Interview Questions Php Interview Questions PL/SQL Interview Questions PostgreSQL Interview Questions PouchDB Interview Questions Prototype Interview Questions Pure CSS Interview Questions Python Interview Questions R programming Language Interview Questions React Native Interview Questions ReactJS Interview Questions RequireJs Interview Questions RESTful Web Services Interview Questions RPA Interview Questions Ruby Interview Questions Ruby on Rails Interview Questions SAS Interview Questions SASS Interview Questions Scala Interview Questions Sencha Touch Interview Questions SEO Interview Questions Servlet Interview Questions SQL Interview Questions SQL Server Interview Questions SQLite Interview Questions Struts Interview Questions SVG Interview Questions Swift Interview Questions Symfony PHP Framework Interview Questions T-SQL(Transact-SQL) Interview Questions TurboGears Framework Interview Questions TypeScript Interview Questions UiPath Interview Questions VB Script Interview Questions VBA Interview Questions WCF Interview Questions Web icon Interview Questions Web Service Interview Questions Web2py Framework Interview Questions WebGL Interview Questions Website Development Interview Questions WordPress Interview Questions Xamarin Interview Questions XHTML Interview Questions XML Interview Questions XSL Interview Questions Yii PHP Framework Interview Questions Zend Framework Interview Questions

WebSockets Interview Questions

1) What is Web Sockets?

Web Sockets is a two way communication between the clients and the servers. Here, the clients and servers both the parties can communicate and exchange data at the same time.

2) What are the features of Web Sockets?

Features of Web Sockets are:
  • Web sockets are transforming to cross platform standard.
  • It provides a two-way communication over single TCP connection.
  • With the help of protocols, the real time communication between web servers and clients is possible.

3) What are the various techniques used for duplex communication between the server and the client?

Techniques used for duplex communication are:
  • HTML5
  • Polling
  • Streaming
  • Long Polling
  • Postback and AJAX

4) What are the main Web Socket API events?

Four main Web Socket API events are:
  • Open
  • Close
  • Error
  • Message

5) How to create a Web Socket connection?

By using the following code:
  1. var socket = new WebSocket('ws://echo.websocket.org');

6) What is onLoad in Web Sockets?

It is an event of Web socket which helps in creation of object of JavaScript and initialization of connection.

7) What is onOpen in Web Sockets?

It is an event of Web Socket which is used to establish a connection with the server and also sends the status of the connection.

8) What is close() method in Web Sockets?

close() method stands for goodbye handshake. The close() method is used to terminates the connection and no data can be exchanged unless the connection opens again.

9) How to create a Web Socket instance in server?

By using the following code:
  1. var server = new WebSocketServer("ws://localhost:8181");

10) What is Send() Method?

Send() Method: It is used to transmits the desired message to the specified client. It is also used to store the text or binary data across the clients.

11) What are the advantages of Web Sockets?

Advantages of Web Sockets are:
  • Full Duplex
  • Bidirectional
  • Single TCP Connection
  • User-friendly API

12) What is XSS in Web Sockets?

XSS stands for Cross-site scripting. It is a vulnerability that enables attackers to inject client-side scripts into web pages.

13) Which method is used to close the Web Socket?

Socket.close() method is used to close the Web Socket.

14) How do the client and the server communicate the following rules defined by the Web Socket protocol?

The client and the server communicate over a Long-lived TCP Socket.

15) How can we check the subprotocol being used by the client?

By checking the protocol property of the socket.

16) Which event is fired when something wrong occurs between the communications in Web Sockets?

onerror event is fired.

17) What is JSON in Web Sockets?

JSON: stands for JavaScript Object Notation. It is a lightweight data-interchange format for transferring human-readable data between the computers.

18) What is RFC 6455?

RFC 6455: It is the latest specification of Web Socket protocol. It is supported by various browsers like Internet Explorer, Google Chrome, Mozilla Firefox and Opera.

19) What are the major drawbacks of AJAX in comparison with Web Sockets?

The major drawbacks of AJAX in comparison with Web Sockets are:
  • Web Server consumes more resources.
  • Communication is half-duplex.
  • In Web Sockets, AJAX send HTTP header which makes total size larger.

20) What is Polling in Web Sockets?

Polling: It is a method or technique which is used for duplex communication between the server and the client. It performs periodic requests regardless of the data that exists in the transmission. Here, periodic requests are sent in a synchronous way.

21) What is Long Polling in WebSockets?

Long Polling: It includes similar technique like polling. The client and the server keep the connection active until some data is fetched or timeout occurs. Long polling is performance improvement over polling process.

22) What are the two main actions that are supported by Web Socket protocol?

The two main actions that are supported by Web Socket protocol are:
  • send( )
  • close( )

23) What is API in Web Sockets?

API: stands for Application Program Interface. API is a set of protocols and routines for building software applications.

24) What are the features of API (Application Program Interface)?

The features of API are:
  • Application Program Interface makes it easier to develop a program by providing all the building blocks.
  • It specifies how software components should interact and APIs should be used with graphical user interface (GUI) components.
  • REST avoids ambiguity.
  • Flexibility is provided by assigning resources (Universal Resource Identifiers).

25) Why REST avoids ambiguity in Web Sockets?

REST avoids ambiguity because each term in REST has a specific meaning (GET, POST, PUT and DELETE).



ADVERTISEMENT
ADVERTISEMENT