×

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).

Related Topics

Top 30 JSF Interview Questions for 2024

1) What is JSF? JSF stands for Java Server Faces is a Java-Based web application framework. JSF (Java Server Faces) provides a facility to connect UI widgets with data sources. 2) What are...

4 minutes read.

Django Interview Questions for 2024

Django is an open-source python web framework. It is very popular due to the functionalities it offers. It uses the Model-View-Template architecture. Many giant organizations are using Django as their...

10 minutes read.

Top 15 Cordova Interview Questions for 2024

Top 20 Cordova Interview Questions and Answers for Freshers 1) What is Cordova? Cordova is a mobile application development framework. Cordova allows building mobile application using HTML5, CSS3, and JavaScript. Cordova is...

3 minutes read.

Top 22 DOJO Interview Questions for 2024

1) What is DOJO? DOJO is an open source JavaScript framework designed for very fast development of JavaScript/AJAX based application and websites having cross platform interdependencies. 2) Enlist all features of DOJO. ...

4 minutes read.

Top 30 Go Programming Language Interview Questions for 2024

1) What is Go Programming language? Go programming language is an open source programming language. It is developed at Google in 2007. It is designed for system programming language. 2) Who designed...

4 minutes read.

Top 15 Java BeanUtils Interview Questions for 2024

1) What is Java BeanUtils? Java BeanUtils is a design pattern component of the Apache Commons. It facilitates architecture for Java language which is derived from JavaAPI. It helps to set...

3 minutes read.

Top 15 VBA Interview Questions for 2024

1) What is VBA? VBA stands for Visual Basic Application. It is an event-driven programming language. It is mainly used with Microsoft Office applications such as MS -Excel, MS-Word and MS-Access. 2)...

3 minutes read.

Top 25 jQuery Interview Questions for 2024

Most Frequently asked jQuery Interview Questions and Answers for Fresher and Experienced 1) Define Find and Children Method? In DOM tree if you have to find all the method we use Find...

4 minutes read.

Top 16 Moo Tools Interview Questions for 2024

1) What is Moo Tools? MooTools stands for My Object-Oriented Tools. It is a lightweight and object-oriented JavaScript framework. It is used to create dynamic web page. It is developed by Valerio...

5 minutes read.

Top 30 Perl interview questions for 2024

1) What is Perl? It is a programming language which is used for web development, system administration, GUI development and etc. It is also known as cross-platform programming language. 2) What are the...

4 minutes read.

Top 15 Website Development Interview Questions for 2024

1) What is Website Development? Website Development is a process that includes following steps. web design web content development client-side or server-side scripting network security configuration etc 2) What are the skills...

3 minutes read.

Top 15 ASP.NET MVC Framework Interview Questions for 2024

1) What is ASP.NET MVC Framework? ASP.NET MVC framework is a software architecture pattern for developing web applications. It is used to split the application's implementation logic into three components: models,...

4 minutes read.

W3.CSS Interview Questions

1) What is W3.CSS? W3.CSS stands for Cascading Style Sheet. It is developed by w3schools.com. It is used to create faster, beautiful and responsive websites. 2) What are the features of W3.CSS? W3.CSS...

3 minutes read.

Top 40 TensorFlow Interview Questions and Answers

Commonly Asked TensorFlow Interview Questions for Fresher Q1. What is TensorFlow? TensorFlow is the machine learning library developed by Google's brain team, it supports multiple abstraction levels, and we can choose the...

13 minutes read.

Top 12 Docker Interview Questions for 2024

Most frequently asked Docker Interview Questions and Answers for Fresher 1. What is Docker? Docker is a new form of Software Containerization in the field of IT. It is an open-source container...

4 minutes read.

Top 31 PHP Interview Questions for 2024

1) What is PHP? PHP is a object-oriented scripting language, open source, interpreted and executed at server side. It is also used to develop web applications. 2) What are the features of PHP? Features...

4 minutes read.

Top 30 AJAX Interview Questions for 2024

1) What is AJAX? AJAX (Asynchronous JavaScript and XML) create better, faster and interactive web-apps. It provides data transfer between web-server and browser. 2) List some advantages of AJAX Advantages are: More Interactive: Very...

3 minutes read.

Bugzilla interview Questions

Frequently asked questions about Bugzilla Q1. What are reports in Bugzilla? A1. Reports can be defined as an interface between the user and the database of Bugzilla. It helps to examine and...

4 minutes read.

Top 16 WebGL Interview Questions for 2024

1) What is WebGL? WebGL stands for Web Graphics Library. It is a JavaScript API that is used for rendering 3D graphic in any compatible web browser. It is written in...

3 minutes read.

Top 15 Apache Tapestry Interview Questions for 2024

1) What is Apache Tapestry? It is an open source web framework written in Java and can work under any application server. It is easily integrate with back ends like Hibernate...

2 minutes read.