Chapter 5. Securing Your Data

In this chapter, we will cover the following recipes:

  • Implementing basic authentication
  • Performing token-based authentication
  • Handling server-side validation
  • Locking down the HTTP referrer
  • Using secure WebSockets

Introduction

Although the WebSocket protocol provides several opportunities for more direct communication between the client and the server, people often wonder if Socket.IO is actually as secure as something similar to the HTTP protocol. The answer to this question is that it depends entirely on how you implement it. WebSockets can be easily controlled to prevent malicious or accidental security holes, but with any API interface, your security is only as tight as your weakest link.

In this chapter, we will explore ...

Get Socket.IO Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.