Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

I am very new to the whole idea of redis and socket.io but I followed this laracast series and I was able to get basic Laravel events to broadcast successfully.
The problem arose when I tried to push my code to my droplet. First some code:
socket.js
var server = require('http').Server();
var io = require('socket.io')(server);
var Redis = require('ioredis');
var redis = new Redis();
redis.subscribe('test-channel');
redis.on('message', function(channel, message) {
console.log(message);
message = JSON.parse(message);
io.emit(channel + ':' + message.event, message.data);
});
server.listen(3000);
main.blade.php
var socket = io('http://localhost:3000');
// not relevant stuff for using Vue.js
socket.on('test-channel:App\\Events\\EventWasCompleted', function(data) {
// push stuff to Vue.js
}.bind(this));
routes.php
Route::get('/fire', function() {
$i = 0;
while ($i < 10) {
event(new EventWasCompleted($i));
$i++;
}
return 'Done';
});
Now what happens is when I am working locally, is that I can visit the main view and hit the localhost/fire route and my event is broadcasting correctly and the results are pushed to the main view.
However, when I tried to push to my droplet, I wasn’t really sure what I needed to change if anything. I ran node socket.js on the server, and I know that it is working because I can see the results of my event in the console. The issue is that my main view does not properly receive the events. If I hit my local route localhost/fire I do catch the events on my production server. However if I send the events from droplet_IP/fire my view can’t catch the events.
What do I need to change to get this to work?
c16a0681e4174db280c83e4625c16d
phosphide
be910cccb6cf4b3ebf23fdcffa5505
7785fb23466745bea08552220fe464
Rashmi Joshi
Zappcode Academy
Mads Jürgensen
bee575eae7d04977a721d68f4f4877
endtoendpaper
David Macias
4029567daede4037840eb514185d21