Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Let's talk WebSockets

Mishal Shah
September 12, 2020

Let's talk WebSockets

An Introduction to WebSockets and comparing the performance of AJAX Requests with WebSockets using Socket.IO library.

Complete video: https://www.youtube.com/watch?v=2G8hrYeDM20

Code built during the session is available here: https://github.com/mishal23/ajax-ws

Mishal Shah: https://mishal23.github.io

Credits: Thanks to K Rahul Reddy & Madhumitha Nara for reviewing my presentation and the code to be presented in the talk!

Connect with them here:
K Rahul Reddy: https://www.linkedin.com/in/k-rahul-reddy/
Madhumitha Nara: https://www.linkedin.com/in/madhumitha-nara/

Mishal Shah

September 12, 2020
Tweet

More Decks by Mishal Shah

Other Decks in Programming

Transcript

  1. About me ‍ Software Engineer in IoT Group, Cisco ‍

    GSoC ‘19 Student, GCI/GSoC Mentor @ ns-3 Lead Organized, HackVerse ‘20 Graduated from NITK, Surathkal
  2. Table of Contents • Introduction to HTTP • Real Time

    Communications • Introduction to WebSockets • Browser Support for WebSockets • Use-cases of WebSockets • Socket.IO Library • Hands on!
  3. A bit about HTTP • Stateless protocol • Different request

    methods: GET/POST/PUT/DELETE • Pull Protocol
  4. Option #2 Long Polling Keep the request alive until data

    is received, send again once data is available
  5. WebSockets • Provides bi-directional, full-duplex communications • WebSockets is an

    upgrade request over HTTP • Uses ws:// or wss:// (instead of http:// or https://)
  6. Use Case of WebSockets • Real-time analytics • Streaming •

    Instant messaging & chat • Documents Collaboration • Games • Anything else that requires low-latency real time connections ⚡
  7. Socket.IO • JavaScript based library for WebSockets • Works on

    every platform, browser and device • Handles auto-reconnection (something not available in WebSockets) • Namespacing
  8. Tools • Node • NPM • Any IDE/Text Editor -

    I’ll use VS Code • Socket.IO