Yes I would be interested too by broadcasting events using nodejs
A good resource for implementing a simple notification system in Laravel 5.1 and Socket.io
I'm using a Mac with Homestead and I also have a Digital Ocean server provisioned using Laravel Forge.
I'm just playing around at the moment but I was wondering if anyone has set up a basic implementation of a notification system using Laravel 5.1 and Socket.io. I appreciate that Laravel 5.1 hasn't been released yet but the process should be similar between that and Laravel 5 (v. 5.0.32).
I am building an app where user's submit timesheets and other data, it is then checked by their superiors and passed up the chain. I would like to know how I can send notifications when a new timesheet was added for example.
I have watched Taylor's episode on Broadcasting Events in Laravel 5.1 but he doesn't go into much detail about the node.js part nor the Redis configuration.
Any tutorials, sample code, and gotchas that I should look out for when using Forge for example, will be greatly appreciated.
Thanks in advance for your input.
@mstnorris no need to do it. If you're using Homestead (like I am), you can just run redis-server from wherever you want.
What might differ from the tutorial I've linked you to is the IP address of the server. In the view file you might have code like
var socket = io('http://localhost:3000');
The localhost part should be substituted with Homestead IP address, which by default is 192.168.10.10, so it should be
var socket = io('http://192.168.10.10:3000');
That should get rid of the "Cannot connect to the server" error. Hope I helped.
Also, if you're following the tutorial, I think in socket.js file you should substitute
io.emit(channel + ':' + message.event, message.payload);
with
io.emit(channel + ':' + message.event, message.data);
Apparently the property name has been changed from payload to data (just tested it now from scratch).
Please or to participate in this conversation.