Top Banner
CONSUMING ASP.NET WEB API WITH WEBSOCKETS Maayan Glikser
17
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Consuming ASP.NET Web API with WebSockets

CONSUMING ASP.NET WEB API WITH WEBSOCKETS

Maayan Glikser

Page 2: Consuming ASP.NET Web API with WebSockets

Maayan Glikser

- Github addict - Hardcore Metal Fan - Converted from dogs to cats

Developer @ 500Tech

Page 3: Consuming ASP.NET Web API with WebSockets

What are WebSockets?

Page 4: Consuming ASP.NET Web API with WebSockets

How WebSockets Work?

Page 5: Consuming ASP.NET Web API with WebSockets

Why use WebSockets for API's?

Page 6: Consuming ASP.NET Web API with WebSockets

How TCP Works

Page 7: Consuming ASP.NET Web API with WebSockets

Diagnosing in Chrome Network Tool

Typical Ajax Request

Page 8: Consuming ASP.NET Web API with WebSockets

TCP Slow-Start

* From High Performance Browser Networking by Ilya GrigorikChapter 1. Primer on Latency And Bandwidth

Page 9: Consuming ASP.NET Web API with WebSockets

Advantages• No HTTP Overhead

• Duplex Connection - Server is able to send updates

• Low latency requests - TCP Connection is already open

• Data transfer grows as more data comes through the pipe

• Can send binary data

• Cross Origin

Page 10: Consuming ASP.NET Web API with WebSockets

Disadvantages• No Caching

• No Proxies

• Clients can lose connection to the server

• Compatibility (IE9 and below)

• Security - CSWSH (Cross Origin Web Socket Hijacking)

Page 11: Consuming ASP.NET Web API with WebSockets

How to use WebSockets for REST API's

Page 12: Consuming ASP.NET Web API with WebSockets

WAMPWeb Application Messaging protocol

www.iana.org/assignments/websocket/websocket.xml#subprotocol-name

Page 13: Consuming ASP.NET Web API with WebSockets

WAMP Router

Page 14: Consuming ASP.NET Web API with WebSockets

DEMO

Page 15: Consuming ASP.NET Web API with WebSockets

Resources• WAMP Protocol

http://wamp.ws/

• High performance Browser Networking By Ilya Grigorik http://chimera.labs.oreilly.com/books/1230000000545

• Web Sockets Security http://www.christian-schneider.net/CrossSiteWebSocketHijacking.html

• More Bandwidth Doesn't matter https://docs.google.com/a/chromium.org/viewer?

srcid=Y2hyb21pdW0ub3JnfGRldnxneDoxMzcyOWI1N2I4YzI3NzE2

Page 16: Consuming ASP.NET Web API with WebSockets

WE ARE HIRING

Page 17: Consuming ASP.NET Web API with WebSockets

Check the slides:

Read our blog:http://blog.500tech.com

Maayan Glikser

http://bit.ly/1C4PJsQ

[email protected]