$30 off During Our Annual Pro Sale. View Details »

Websockets in PHP using Swoole

Websockets in PHP using Swoole

Ricardo Coelho

August 19, 2022
Tweet

More Decks by Ricardo Coelho

Other Decks in Programming

Transcript

  1. Ricardo Coelho - @ramcoelho Websockets in PHP using Swoole

  2. Agenda Websockets & HTTP/1.1 Ratchet & Swoole Concurrency, asynchrony &

    parallelism Multithread, fi bers & coroutines Shared memory & semaphores Streams, gRPC, protobuf, HTTP/2, HTTP/3 & QUIC
  3. Websockets

  4. None
  5. Supervisor

  6. FROM php:8.1.9 RUN apt-get update \ && apt-get install -y

    libssl-dev git zip wget \ && cd /tmp \ && wget https://github.com/swoole/swoole-src/archive/refs/heads/master.zip -O swoole-src.zip \ && unzip swoole-src.zip && cd swoole-src-master \ && phpize && ./configure && make && make install \ && cd / && rm -rf /tmp/pear \ && docker-php-ext-install sockets \ && docker-php-ext-enable swoole sockets nexy/swoole:8.1.9
  7. Ratchet & Swoole

  8. None
  9. Concurrency, asynchony & parallelism

  10. Multithread, fibers & coroutines

  11. Shared memory & semaphores

  12. Websockets vs gRPC

  13. HTTP/1.1

  14. TCP/IP

  15. IP + Porta IP + Porta

  16. TCP/IP

  17. None
  18. None
  19. None
  20. HTTP/2 & Streams,

  21. Multiplex

  22. TCP/IP

  23. None
  24. HTTP/3 & QUIC

  25. QUIC QUIC QUIC QUIC QUIC QUIC QUIC QUIC

  26. Ossification

  27. “Respect the past, and prepare for the future by taking

    action in the present.” Rob Martin
  28. UDP UDP UDP UDP UDP UDP UDP UDP

  29. Performance

  30. Conclusion

  31. None
  32. References • https://www.rfc-editor.org/rfc/rfc6455 • https://datatracker.ietf.org/doc/html/rfc9000 • https://www.rfc-editor.org/rfc/rfc7540.html • https://datatracker.ietf.org/doc/html/rfc9114 •

    https://unsplash.com • http://socketo.me • https://openswoole.com • https://speakerdeck.com/ramcoelho/swoole • https://github.com/nexy/swoole The WebSocket Protocol QUIC: A UDP-Based Multiplexed and Secure Transport Hypertext Transfer Protocol Version 2 (HTTP/2) HTTP/3 Images Ratchet Websockets Open Swoole These slides Code used in these slides