WebSockets in nodejs
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

WebSockets in nodejs

on

  • 939 views

Talk from berlinjs 18. April 2013

Talk from berlinjs 18. April 2013

Statistics

Views

Total Views
939
Views on SlideShare
939
Embed Views
0

Actions

Likes
0
Downloads
17
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

WebSockets in nodejs Presentation Transcript

  • 1. How to implement WebSockets in nodejsFreitag, 19. April 13
  • 2. Why actually implement a protocol? bad support want to learn more too much timeFreitag, 19. April 13
  • 3. WebSocket Overview http upgrade data framingFreitag, 19. April 13
  • 4. http upgrade Request GET ws://localhost:3000/ HTTP/1.1 Host: localhost:3000 Origin: http://localhost:3000 Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: balUGY40R1lyHPJZf3XHqQ== Sec-WebSocket-Extensions: x-webkit-deflate-frame Sec-WebSocket-Protocol: chat Sec-WebSocket-Version: 13 Response HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: GCPOtLmN+iCXPREPmHfgCKsCllU= Sec-WebSocket-Extensions: x-webkit-deflate-frame Sec-WebSocket-Protocol: chat Sec-WebSocket-Version: 13Freitag, 19. April 13
  • 5. data framing unmasked text frame containing „Hello“ 10000001 0x81 FIN: Boolean RSV1: Boolean 00000101 0x05 RSV2: Boolean RSV3: Boolean 01001000 0x48 H OPCODE: Number MASK: Boolean 01100101 0x65 e LENGTH: Number MASKING: Buffer 01101100 0x6c l PAYLOAD: Buffer 01101100 0x6c l 01101111 0x6c oFreitag, 19. April 13
  • 6. Freitag, 19. April 13
  • 7. Architecture: First Take... WebSocketServer WebSocketClient WebSocketUpgrade WebSocketBase WebSocket WebSocketFrame SocketFreitag, 19. April 13
  • 8. Freitag, 19. April 13
  • 9. Architecture: Second Take WebSocketServer WebSocketUpgrade WebSocketSocket Incoming Outgoing WebSocketCore WebSocketParser SocketFreitag, 19. April 13
  • 10. End only use ws for chat-like use-cases use streams where you can don`t worry v8 is fast enough https://github.com/bodokaiser/node-websocketsFreitag, 19. April 13