tlaverdure / laravel-echo-server

Socket.io server for Laravel Echo
MIT License
2.64k stars 509 forks source link

Giving error while sending http request via python requests library #545

Open nnnayeem opened 3 years ago

nnnayeem commented 3 years ago

Describe the bug While sending http request laravel-echo-server stops and showing error in the terminal.

To Reproduce Steps to reproduce the behavior:

  1. Generate Api Clinet id
  2. use the api client id as follows: http://sena.test:6001/apps/APP_ID/events?auth_key=f06f050a7cfa738fd434f586b869c302
  3. sending post request via python requests library
  4. Request body as follows(for demo purpose I did not change the channel-name, event-name):
    {
    "channel": "channel-name",
    "name": "event-name",
    "data": {
      "key": "value"
    }
    }

    5.showing error as follows:

    
    undefined:1
    channel=channel-name&name=event-name&data=key
    ^

SyntaxError: Unexpected token c in JSON at position 0 at JSON.parse () at HttpSubscriber.handleData (C:\Users\USER\AppData\Roaming\npm\node_modules\laravel-echo-server\dist\subscribers\http-subscriber.js:42:21) at IncomingMessage. (C:\Users\USER\AppData\Roaming\npm\node_modules\laravel-echo-server\dist\subscribers\http-subscriber.js:21:59) at IncomingMessage.emit (events.js:203:15) at endReadableNT (_stream_readable.js:1145:12) at process._tickCallback (internal/process/next_tick.js:63:19)



**Expected behavior**
Subscribe to the channel.

**Additional context**
I am building a desktop application using python. In doing so, I need to subscribe to laravel-echo-server channel via python whenever Laravel broadcast new event. I googled and found most of the websocket tutorial are about creating server and client and interaction between them.
Can I achieve this using laravel-echo-server or I have to built my own.