In PAL 0.11, onconnect
lifecycle has been disliked for callback sockets. The upgrade guide says that if you need to do a preliminary setup when adding a new socket, "send initial request to client after connecting the socket".
Sending a request from connected clients is quite easy. But if you are not using onconnect
lifecycle callback to capture the socket on the server, how do you set up an audience for that event? Is there another way to capture the socket that set out the onconnect
function for that socket?
It is a thought that on the front seal socket client to call a regular endpoint in your cell backend. To use A part of the magic of the cell roots the socket requests as if they were regular HTTP requests. So at the front end you can do this:
& lt; Script src = "/ js / dependency / sails.io.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; // While the socket will actually be queued up to IO.socket.get ("/ helloworld", the function (response) {console.log ("received response:", response);}); & Lt; / Script & gt; The / helloworld
route that you set up in your config / routes.js
file, to make calls and to make any "on-connect" calls - < / Code>
Setting Style there
in your controller action to make sure Are there.
No comments:
Post a Comment