VKCOM / kphp

KPHP — a PHP compiler
https://vkcom.github.io/kphp/
GNU General Public License v3.0
1.35k stars 90 forks source link

PHP WebSockets #105

Open hossein-zare opened 3 years ago

hossein-zare commented 3 years ago

Hello, is WebSocket (the socket_create() function and some other funcs) supported or not implemented?

exikyut commented 3 years ago

PHP's socket_create() function is to WebSockets, which specifies additional framing, like chalk is to cheese. WS implementations can be very small (mine is ~100 lines), but it's definitely not built in.

As an aside, I personally find the sockets extension very... idiosynchratic, and tend to strongly prefer the stream_ functions everywhere I can.

/functions.txt currently only lists stream_socket_client, suggesting that stream_socket_server is yet to be implemented. (Note, that link goes to a1c816, which was current as of writing this comment.)

giosh04 commented 2 years ago

PHP's socket_create() function is to WebSockets, which specifies additional framing, like chalk is to cheese. WS implementations can be very small (mine is ~100 lines), but it's definitely not built in.

As an aside, I personally find the sockets extension very... idiosynchratic, and tend to strongly prefer the _stream__ functions everywhere I can.

/functions.txt currently only lists stream_socket_client, suggesting that stream_socket_server is yet to be implemented. (Note, that link goes to a1c816, which was current as of writing this comment.)

Can you please share websocket client implementation?