reactphp-legacy/socket-client

socket client without neverending loop

bashilbers opened this issue · 3 comments

Is there a way to instantiate a pushing client which doesnt care about incoming messages? The current socket client requires a StreamSelectLoop argument..

An EventLoop is required as it does the async writes as well. If you don't want to receive any data from the server you can do the following:

->then(function (React\Stream\Stream $stream) {
    $stream->pause();
});

Ok thanks, but why do I need a DnsResolver? I know my ip address and port of the socket server, isnt that enought?

The createForAddress method will actually never use the DnsResolver instance..

clue commented

I've confirmed @cboden's suggestion to work as expected. IMO this is a sensible approach. I assume this solves your question and we can close this ticket? If not, feel free to comment and we can re-open this.

why do I need a DnsResolver?

PR #7 addresses this by making the Resolver optional. Let's try to move this discussion to this PR.