3. Topics
▷ What is WebSocket;
▷ Browser Support;
▷ About Ratchet;
▷ Difficulties;
▷ Examples;
▷ Conclusion;
▷ Questions.
4. Hello!
I'm Leonardo Rifeli
▷ Back-end developer at ContaAzul
▷ I'm 20 years old
▷ I developed more than 100 websites
▷ Writer at leonardorifeli.com
▷ And I'm a Java developer too
7. Definition of WebSocket
Basicamente, é uma conexão bi-direcional de
um navegador web para um servidor. Depois
que uma conexão socket é estabelecida a
conexão permanece aberta até que o cliente ou
servidor decida encerrar.
O cliente ou servidor pode enviar uma
mensagem a qualquer outro cliente conectado.
Uma única aplicação de servidor em execução
estará ciente de todas as conexões abertas.
13. Chats
Yes! They are
developed with
socket
communication.
Some Implementations
Games
The games that
use real-time
update. Message
by users.
Some Apps
Example (Google
Docs):
18. About Ratchet
Ratchet is a loosely coupled PHP library
providing developers with tools to create real
time, bi-directional applications between
clients and servers over WebSockets. This is
not your Grandfather's Internet. (socketo.me
description).
Ratchet is fully PSR-0 compliant, so it naturally
plays well with others. Leveraging components
from Symfony2, development should feel
similar to many.
22. Implementation
▷ RatchetServerIoServer: Creates an open-ended socket to
listen on a specific port. Events are delegated through this to
attached applications.
▷ RatchetHttpHttpServer: Implement the interface
MessageComponentInterface and manages the connections.
▷ RatchetWebSocketWsServer: The adapter to handle
WebSocket requests/responses. his is a mediator between the
Server and your application to handle real-time messaging
through a web browser.
▷ HermesBusinessServiceSocketService: It will be the
implementation of websocket methods and contain all business
rule.