Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

9. Hacking HTML5 Connectivity > Hack 71. Build a Blazing-Fast WebSocket Server ...

Hack 71. Build a Blazing-Fast WebSocket Server with Node.js and the ws Module

The Node.js ws module is an easy-to-use, blazing-fast and up-to-date web socket implementation that you can use to get web sockets up and running quickly. It also ships with wscat, a command utility that can act as a client or server.

In this hack we will explore the fastest WebSocket Server I could find. I discovered the ws module for Node.js. It just so happens that ws is not only blazing-fast, but also quite simple to set up. The simplicity of its implementation will make this hack the ideal introduction to web sockets.

The ws module is up-to-date against current HyBi protocol drafts, and can send and receive typed arrays (ArrayBuffer, Float32Array, etc.) as binary data. So although it may be simple, it’s not a toy.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint