question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

it always auto disconnect from server(use php swoole)

See original GitHub issue

i had read the document, but i can’t find the answer, so i write this question for need help;

Note: for support questions, please use one of these channels: stackoverflow or slack

You want to:

  • report a bug
  • request a feature
  • need help

Current behaviour

auto disconnect from server

Steps to reproduce (if the current behaviour is a bug)

client code: `var socket = io(‘127.0.0.1:9502’, { transports: [‘websocket’], });

socket.connect(); socket.on(‘connect’, function(){ socket.send(‘Hello, i am HMM’); console.log(‘Connected to server’); }); ` server code:

`$ws = new swoole_websocket_server(‘0.0.0.0’, 9502);

$ws->on(‘open’, function(swoole_websocket_server $server, $request) { echo “Open\n”; $server->push($request->fd, “hello, welcome\n”); });

$ws->on(‘message’, function($server, $request) { echo “Message: {$request->data}\n”; $server->push($request->fd, “server:{$request->data}”); });

$ws->on(‘close’, function($server, $fd) { echo “client-{$fd} is closed\n”; });

$ws->start(); ` step1: run server php server.php step2: run client open the html page on the browser; step3: get infomation from server Open client-1 is closed Open client-2 is closed Open client-3 is closed Open client-4 is closed Open client-5 is closed Open client-6 is closed … Note: the best way to get a quick answer is to provide a failing test case, by forking the following fiddle for example.

Expected behaviour

keep alive

Setup

  • OS: ubuntu 16.4 (64-bit)
  • browser: firefox 54.0
  • socket.io version: v2.0.3

Other information (e.g. stacktraces, related issues, suggestions how to fix)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
QiiSyhxcommented, Aug 31, 2017

Thanks. If i use the native websocket, it’s work! var socket = new WebSocket('ws://localhost:9502'); socket.send('Hello'); I will receive a message from terminal: Message: Hello And i don’t know socketio how to work. i will check it agin.

1reaction
darrachequesnecommented, Aug 30, 2017

Hi! I don’t know the Swoole project, is it supposed to be compatible with the socket.io client?

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenSwoole Server Configuration | Open Swoole PHP
If you are not running a server, the PID file is not automatically deleted if your process is stopped. You could use OpenSwoole\Process:: ......
Read more >
Swoole: Is it Node in PHP or am I wrong? - HackerNoon
To test the performance of HTTP server using Swoole, I've created an app in Node — which can do exactly the same thing...
Read more >
Using Swoole in production : r/PHP - Reddit
I am looking into Swoole as I am having issues with not ReactPHP but the event loop extensions (I've tried them all). My...
Read more >
PECL :: swoole Changelog - PHP
Optimized admin server code (swoole/library#128) (swoole/library#131) ... + Automatically add Content-Type header when use sendfile (4e62bc52) (@matyhtf)
Read more >
Axie infinity Tips & Tricks: How to Fix Infinity Server Disconnects
Number of Workers: LaravelS uses Swoole's Synchronous IO mode, ... Runtime files: start will automatically execute php artisan laravels config and generate ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found