Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No support for websockets? #227

Closed
Henshall opened this issue Mar 21, 2020 · 3 comments
Closed

No support for websockets? #227

Henshall opened this issue Mar 21, 2020 · 3 comments
Labels

Comments

@Henshall
Copy link

Hello - I have been trying to get web sockets working with this for the last few days - specifically url's such as "wss://cerberus-xxxx.lb.slack-msgs.com/websocket/KHAM3gifDwkNzSW1epUuKursfVk...". Is this type of url supported? It seems that it does not work but also does not return any errors.

I have the following code:

$loop = Factory::create();
$connector = new Connector($loop);
$connector->connect($url)->then(function (ConnectionInterface $connection) use ($loop) {
$connection->pipe(new WritableResourceStream(STDOUT, $loop));
$connection->write('{
"type": "message",
"ts": "11111",
"user": "noone",
"text": "sample text"
}');
});
$loop->run();

Thank you!

@HLeithner
Copy link

Reactphp Sockets are RAW Socket connections, Websockets is a protocol which needs an implementation like Ratchet or Thruway.

There is a blog post by @WyriHaximus about this topic https://blog.wyrihaximus.net/2015/03/reactphp-sockets/

@ghost
Copy link

ghost commented Mar 21, 2020

As mentioned, react/socket implements raw sockets while WebSockets is a network protocol on top of TCP/IP sockets and uses HTTP as initial handshake. You should check out Pawl and WebSocketMiddleware for websocket client and server respectively. Or Ratchet for a higher level websocket server.

They all build on top of ReactPHP to implement websockets.

@clue clue added the question label May 11, 2020
@clue
Copy link
Member

clue commented May 11, 2020

I'll assume this is resolved and will close this for now, please feel free to report back otherwise 👍

@clue clue closed this as completed May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants