Why doesn’t Web Sockets use SOAP?

html, soap, websocket

Solution

Sounds to me like you've not yet fully grasped the concepts around Websockets. For example you say:

Considering web sockets are client-side

This is not the case, sockets have 2 sides, you could think of these as a Server and a Client, however once the connection is established the distinction blurs - you could then also think of the client and the server as "peers" - each can write or read in to the pipe that connects them (the socket connection) at any time. I suspect you'd benefit from learning a little more about HTTP works on top of TCP - WebSockets is similar / analogous to HTTP in this way.

Regarding SOAP / WSDL, from the point of view of a conversation surrounding TCP / WebSocket / HTTP you can think of all SOAP / WSDL conversations as being identical to HTTP (i.e. normal web page traffic).

Finally, remember the stacked nature of network programming, for instance SOAP/WSDL looks like this:

SOAP/WSDL
--------- (sits atop)
HTTP
--------- (sits atop)
TCP

And WebSockets look like this

WebSocket
--------- (sits atop)
TCP

HTH.

Problem

First off, I intend no hostility nor neglegence, just want to know people's thoughts. I am looking into bi-directional communication between client and server; client being a web application. At this point I have a few options: MS-proprietary duplex binding, from what I hear unreliable and unnatural: comet, and web sockets (for supported browsers). I know this question has been asked in other ways here, but I have a more specific question to the approach. Considering web sockets are client-side, the client code sits in JavaScript. Is it really the intention to build a large chunk of an application directly in JavaScript? Why didn't W3C do this in web services? Wouldn't it be easier if we were to be able to use SOAP to provide a contract and define events along with the existing messaging involved? Just feels like the short end of the stick so far. Why not make it simple and take advantage of JS dynamic nature and leave the bulk of code where it belongs....on the server? Instead of ``` mysocket.send("AFunction|withparameters|segmented"); ``` we could say ``` myServerObject.AFunction("that", "makessense"); ``` and instead of ``` ... mysocket.onmessage = function() { alert("yay! an ambiguous message"); } ... ``` we could say ``` ... myServerObject.MeaningfulEvent = function(realData) { alert("Since I have realistic data...."); alert("Hello " + realData.FullName); } ... ``` HTML 5 took forever to take hold....did we waste a large amount of effort in the wrong direction? Thoughts?

Original source