问题描述:

I have a simple blog site where user can comment on blog. I just want to show a simple popup notification to the blog author when someone comments on his blog.

I have already read this:

https://laravel.com/docs/5.3/broadcasting#introduction

Here is what I did to achieve the task:

1) Setup an event, which gets fired upon new comment

2) Imported:

<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script>

in blade template

3) Added in, resources\assets\js\bootstrap.js: (as per the Laravel documentation says)

import Echo from "laravel-echo"

window.Echo = new Echo({

broadcaster: 'socket.io',

key: 'http://blog.local:6001'

});

4) I have setup this package as per the: https://github.com/tlaverdure/laravel-echo-server#laravel-echo-server

5) Fired command: laravel-echo-server start

When, I open the web browser and check console, I'm continuously getting this errors:

socket.io-1.4.5.js:1 GET http://blog.local/socket.io?EIO=3&transport=polling&t=LZkVvZQ 404 (Not Found)

Here is my "laravel-echo-server.json"

{

"appKey": "7k2g9nlm6i492ckorlmp35ng4frusfmt4uq1n68usn3re5lcl4sfg3gibi5d",

"authHost": null,

"authEndpoint": "/broadcasting/auth",

"database": "sqlite",

"databaseConfig": {

"redis": {},

"sqlite": {

"databasePath": "/database/laravel-echo-server.sqlite"

}

},

"devMode": false,

"host": "blog.local",

"port": "6001",

"referrers": [],

"socketio": {},

"sslCertPath": "",

"sslKeyPath": ""

}

I think some issues with socket connection.

Let me know, if anyone needs some more info.

Any help would be appreciated.

Note:

I'm not sure that, do I really need this package for my purpose or not. I just installed it because it was mentioned on Laravel's documentation. As I said I just need real time popup notification.

Thanks,

Parth vora

相关阅读:
Top