3 ms·
> Except it’s not, because everything goes through a router, so how’s that different from using an HTTP server in terms of moving parts? It gives you the API t
by sametmax 12y ago
> Except it’s not, because everything goes through a router, so how’s that different from using an HTTP server in terms of moving parts?
It gives you the API to work as is and the speed of it for RPC is close enough. If you had to do it with HTTP, you'd have to code the linking mechanisme, make use you use keep alive and manually drop the headers.
> - Can work outside of browsers.
> So can HTTP.
Yes, but is has no routing system. You'd have to code it yourself, again. And since it's not websocket, make sure all clients use keep-alive (most default settings for lib such as urllib2 do not), create a standard for all the clients to talk to each others, drop the headers, agree on serialisation, include exceptions handling, wrap that in an async API. And even with keep alive, websocket is x10 faster than Ajax in my tests.
> - Allows independent microservices.
> Again, so does HTTP.
And again, you'll have to hack around HTTP to get this. HTTP is not made for this, it's made to be stateless. It's made to be text. It's made to be simple. You can do anything with HTTP, you could even use it to say, send the packet to sync a starcraft game LAN. But you don't, because it's not efficient. You can cut your meat with a spoon, provided you sharpen it and hold it in a weird way, and force. But you don't. You use knives.
> - Has push and pub/sub.
> Ok, but so does anything based on websockets, I don’t see how that’s an argument for this protocol.
You don't have primitive to do pub/sub with raw websocket. Websocket allo you to push data, but the registering logic, the serilialization, the exception hanlding and the routing are not included. WAMP is a standard for that.
It's not trying to be magical. It's not pretentious. It's not revolutionary. It's just that : a standard to do efficient RPC and PUB/SUB, with clean, simple API that works in the browser, and outside of it.
And it's good at it.