Websockets Bring Light at the End of the Tunnel Presented by JOEL - - PowerPoint PPT Presentation

websockets bring light at the end of the tunnel
SMART_READER_LITE
LIVE PREVIEW

Websockets Bring Light at the End of the Tunnel Presented by JOEL - - PowerPoint PPT Presentation

Websockets Bring Light at the End of the Tunnel Presented by JOEL LORD THINK. CODE. COLLABORATE. Node PDX June 20 th , 2016 spiria.com Aboot me, eh? JOEL LORD - Javascript junkie - Tinkerer - Technology enthusiast @joel__lord


slide-1
SLIDE 1

THINK. CODE. COLLABORATE.

spiria.com

Websockets Bring Light at the End of the Tunnel

JOEL LORD

Presented by Node PDX – June 20th, 2016

slide-2
SLIDE 2

Aboot me, eh?

JOEL LORD

  • Javascript junkie
  • Tinkerer
  • Technology enthusiast

@joel__lord #nodepdx

slide-3
SLIDE 3

WEB SOCKETS

What are they?

slide-4
SLIDE 4

WebSocket is a protocol providing full-duplex communications channels over a single TCP connection.

The WebSocket protocol was standardized by the IETF as RFC 6455 in 2011, and the WebSocketAPI in Web IDL is being standardized by the W3C.

@joel__lord #nodepdx

slide-5
SLIDE 5

Typical real-time

NORMAL HTTP REQUESTS

@joel__lord #nodepdx

Client Server Time

slide-6
SLIDE 6

Typical real-time

POLLING

@joel__lord #nodepdx

Client Server Time

slide-7
SLIDE 7

Typical real-time

LONG-POLLING

@joel__lord #nodepdx

Client Server Time

slide-8
SLIDE 8

Typical real-time

WEBSOCKETS

@joel__lord #nodepdx

Client Server Time

slide-9
SLIDE 9

Typical real-time

WHAT ABOUT SERVER-SIDE EVENTS?

@joel__lord #nodepdx

Client Server Time

slide-10
SLIDE 10

Pros and cons.

slide-11
SLIDE 11

Bi-directional data transfers Fast Low bandwith Detects connection and disconnection

01

PROS

@joel__lord #nodepdx

slide-12
SLIDE 12

Lose the caching capabilities built in XHR and HTTP Architectural changes in the application

02

CONS

@joel__lord #nodepdx

slide-13
SLIDE 13

WebSockets in the Wild

REAL WORLD CASES

@joel__lord #nodepdx

  • Real time synchronization of data amongst a group of users (trello.com)
  • Live feeds (Twitter stream)
  • Long server processes and providing ETAs to users
  • Multiplayer HTML5 games
  • Chat clients (Slack)
slide-14
SLIDE 14

Using WebSockets with HTML5

ESTABLISHING A CONNECTION

@joel__lord #nodepdx

slide-15
SLIDE 15

Using WebSockets with HTML5

EVENTS

@joel__lord #nodepdx

slide-16
SLIDE 16

Using WebSockets with HTML5

SENDING DATA TO THE SERVER

@joel__lord #nodepdx

slide-17
SLIDE 17

Getting started

VARIOUS IMPLEMENTATIONS

@joel__lord #nodepdx

  • PubNub (cloud)
  • Ratchet (php)
  • Jetty (Java)
  • socket.io (node.js)
slide-18
SLIDE 18

Here comes Socket.io!

WHAT’S SO COOL ABOUT IT?

@joel__lord #nodepdx

  • Server and client-side implementation
  • Falls back to long polling when necessary (IE 9 ฀)
  • Adds features like heartbeats, timeouts, and disconnection support not

provided in WebSocket API

  • Easy stuff !
slide-19
SLIDE 19

Here comes Socket.io!

CLIENT SIDE

@joel__lord #nodepdx

slide-20
SLIDE 20

Here comes Socket.io!

SERVER SIDE

@joel__lord #nodepdx

slide-21
SLIDE 21

LET’S GET SERIOUS

Coding time!

slide-22
SLIDE 22

THINK. CODE. COLLABORATE.

spiria.com

The end!

JOEL LORD

Node PDX – June 20th, 2016 Presented by

@joel__lord #nodepdx /joellord