This link probably describes what you are trying to do:
How do Socket.io and RESTFul work together?
It is wrong to want to have messages like GET, SET, DELETE. Repeating the use of the existing API structure is wrong - you still need routing and the URI can be parsed by your server side routing to match the controller for GET / SET / DELETE.
eg:.
socket.emit('set', {uri: '/questions/199060/how-can-socketio-and-restful-work-together', params: {someKey: "someValue}).
This does not use what websockets does well - bidirectional communication, but it does allow streaming requests, which are likely to be faster depending on how often you poll your data.
Good luck and stay frosty!
source share