Supported Protocols in Workerman

Workerman supports various protocols at the interface level, as long as they conform to the ConnectionInterface interface (see the Custom Communication Protocol section).

For the convenience of developers, Workerman provides support for the HTTP protocol, WebSocket protocol, as well as a very simple text protocol and a frame protocol for binary transmission. Developers can directly use these protocols without the need for secondary development. If none of these protocols meet the requirements, developers can refer to the Custom Protocol section to implement their own protocol.

Developers can also directly use the TCP or UDP protocols.

Protocol usage examples

// HTTP protocol
$worker1 = new Worker('');
// WebSocket protocol
$worker2 = new Worker('websocket://');
// Text protocol (telnet protocol)
$worker3 = new Worker('text://');
// Frame protocol (for binary transmission)
$worker3 = new Worker('frame://');
// Directly based on TCP transmission
$worker4 = new Worker('tcp://');
// Directly based on UDP transmission
$worker5 = new Worker('udp://');