Hasnayeen/invobook

`Echo Is Not Defined`: socket not working, Echo not connecting

dougblackjr opened this issue · 11 comments

Your environment:

Ubuntu 19.04

Description:

socket.io is not loading, console error reported of Echo is not defined

Steps To Reproduce:

@dougblackjr which laravel-echo-server.json file are you using to run echo-server? If you're running dev version then start echo server with laravel-echo-server.dev.json file, like below
laravel-echo-server start --dir=laravel-echo-server.dev.json

@Hasnayeen Using the production one. Here is my current config (with some variables changed):

{
  "authHost": "https://url-of-site",
  "authEndpoint": "/broadcasting/auth",
  "clients": [
    {
      "appId": "bec9d450fbf2af78",
      "key": "adeb2fe782d9d3dcd955ac5a88aff184"
    }
  ],
  "database": "redis",
  "databaseConfig": {
    "redis": {},
    "sqlite": {
      "databasePath": "/database/laravel-echo-server.sqlite"
    }
  },
  "devMode": false,
  "host": null,
  "port": "6001",
  "protocol": "https",
  "socketio": {},
  "secureOptions": 67108864,
  "sslCertPath": "/etc/nginx/ssl/------.crt",
  "sslKeyPath": "/etc/nginx/ssl/------.key",
  "sslCertChainPath": "",
  "sslPassphrase": "",
  "subscribers": {
    "http": true,
    "redis": true
  },
  "apiOriginAllow": {
    "allowCors": false,
    "allowOrigin": "",
    "allowMethods": "",
    "allowHeaders": ""
  }
}

My only question is whether the app ID and key need to be changed, those both came over what was in the repo.

ID and key doesn't need to be changed, after starting echo server do you see any error? what's the last few output lines?

No error, just says that server is started.

L A R A V E L  E C H O  S E R V E R

version 1.6.0

Starting server...

✔  Running at localhost on port 6001
✔  Listening for http events...
✔  Listening for redis events...

Server ready!

any error on console? also check the network tab for socket.js call, whats the response of that?

socket.js call times out without any response.
Screen Shot 2020-02-21 at 8 16 18 AM

Error in console is Echo is not defined.
Screen Shot 2020-02-21 at 8 16 32 AM

check the url for socket.js call?

Correct, that file is not in the repo. Did I miss a step in the installation process?

maybe reinstall laravel-echo-server , socket.io is a dependency of laravel-echo-server and will be available from echo server not from repo public directory

I just went ahead and moved to pusher for now. Thank you!

sorry could not help you further, but hopefully you figured it out