user1482015
user1482015

Reputation:

can JavaScript websocket get return value from server?

javascript websocket send()

Hello, I am a newbie of websocket programming.
I have read and try the javascript websocket send(), it send a message to websocket server.
Can I call the server and get return value from server? or I must use the WAMP sub-protocol?

Upvotes: 0

Views: 3663

Answers (1)

oberstet
oberstet

Reputation: 22051

WebSocket is low-level, point-to-point messaging. There is no such thing as "call a procedure on a server and get a result".

If you want to have such "remote procedure calling" (RPC), you need to layer something on top of WebSocket. WAMP provides that in an open standard protocol.

Of course you could also reinvent the wheel and implement your own RPC. But then you cannot reuse WAMP implementations like Rachet (currently WAMP v1 only) or Thruway (WAMP v2).

Upvotes: 1

Related Questions