This might be out of the question's scope. If external ports are not allowed, maybe Pusher could be an alternative candidate? https://pusher.com/
awsp said:
This might be out of the question's scope. If external ports are not allowed, maybe Pusher could be an alternative candidate? https://pusher.com/
It could be great from a technical point of view, but for privacy and security reasons I can not use an external service for a significant portion of my projects.
Thanks for the input anyway!
In some projects i use slanger, for the same reasons you mention. Its a self hosted server compatible with pushers api. https://github.com/stevegraham/slanger
Edwin-Luijten said:
In some projects i use slanger, for the same reasons you mention. Its a self hosted server compatible with pushers api. https://github.com/stevegraham/slanger
I'm sorry to say that Slanger seems rather dead to me. I prefer well known and stable libraries, because I have experience with Ardent and Sentry...
You speak about 'some projects' you use Slanger for; do you use other techniques for the other projects or don't they require real time interaction?
I personally like node pared with socket.io, as you said you would need to setup nginx to route requests to the running node script.
I'm sure you can route the node socket to a subdomain, so no other ports than 80 would be open.
happyDemon said:
I personally like node pared with socket.io, as you said you would need to setup nginx to route requests to the running node script.
I'm sure you can route the node socket to a subdomain, so no other ports than 80 would be open.
Thanks for the input!
How do you access Node.JS from Laravel and vice versa?
You can setup node to make use of the same database as your laravel app would be using.
Socket.io has a handshake process to authorize users: https://github.com/Automattic/socket.io/wiki/Authorizing, since the socket's open the user's browser, as an example, you could let socket.io client send an ajax request to laravel to generate an authentication token, store it in the database and send it back to the socket.io server so it knows which user the socket connection belongs to.
That's one way, if you google it, there's plenty of ways to do this authentication.
I've found another one: http://stackoverflow.com/questions/7988192/how-to-authenticate-socket-io-against-php-session-id-across-domains
Setting PHP to save user's sessions in redis would also make them available for nodeJS to access them.
Another option would be to read cookies (which I'm not a total fan of)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community