Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Reacting with ReactPHP 2019

Reacting with ReactPHP 2019

Demonstrates some of the basic concepts of how ReactPHP works.

Bob Majdak Jr

October 08, 2019
Tweet

More Decks by Bob Majdak Jr

Other Decks in Programming

Transcript

  1. Just because you received data, does not mean it is

    all your data. Example: Windows telnet sends every keypress as it happens. Unix telnet waits until new line.
  2. Messages could get broken up into multiple packets and arrive

    to the client in the wrong order. That is how the internet works. As they arrive the NIC may choose to send you what it can construct properly *now* and wait until later to send the rest.
  3. 6 8 9 1 2 3 4 7 5 oh

    hai guiz 6 8 9 7 5
  4. • EventLoops • React\Socket\Server • connection, error • React\Socket\Connection •

    data, close, error • Ratchet\WsServer • Class implementing MessageComponentInterface • open, close, error, message
  5. • Clients are basically the same as servers. • Servers

    need to know how to handle: connections, data inputs, disconnections. • Clients need to know how to handle: data inputs, disconnections. • Both need to be able to: send data to the other.
  6. WEBSITE: i need this report SERVER: ok, come back later.

    WEBSITE: ok thanks. SERVER: you there, you are not doing anything. generate this report. WORKER1: ok i’m off to work on it. bbl. // 30 min later WORKER1: all done. website can view it whenever. SERVER: ok thanks. i’ll email that bloke.