WebSockets enable two-way communication between the user’s browser (the client) and a server. They can be used to enable dynamic, interactive web experiences. After reading and practicing, you should be able to:
onopen
event handler function to detect when the connection has been openedonmessage
event handler function to detect and process messages sent by the serveronerror
event handler function to detect when an error has occurredsend()
method to send messages to the serverclose()
method to close the connection to the serveronclose
event handler function to detect when the connection to the server has been closedws
package to create a standalone WebSocket serverws
package to create a WebSocket server that shares a Node.js http
server with an Express applicationconnection
event handler listener method to detect when a client has connected to the WebSocket serverclose
event handler listener method to detect when a client has closed the connection to the WebSocket serversend()
method to send a message to a client