Need update wiki with worked examples, but the problem with websockets is more complex. and even this not help because core protocol of socket.io implemented wrong way. Ping\Pong also not working. The feeling that the implementation of web sockets in this package was abandoned on the half way.
Updated:
So, expirience way i found that this websocket implementation work only with socket.io-client version 2.
That what you need to do on the fronted side:
npm i socket.io-client@v2-latest
After that use this code for starting point:
import io from "socket.io-client";
const socket = io("ws://127.0.0.1:1215", {
// transports: ["websocket"], //if you want force ws: connection instead of initial http:
});
socket.on("connect", function (event) {
console.log(event);
});
function handleClick() {
socket.emit("hello", { text: "i say hey" });
}
I hope this help for anyone.
But anyway - wiki must be updated or laravel-swoole package must be updated to actual state.
Need update wiki with worked examples, but the problem with websockets is more complex. and even this not help because core protocol of socket.io implemented wrong way. Ping\Pong also not working. The feeling that the implementation of web sockets in this package was abandoned on the half way.
Updated: So, expirience way i found that this websocket implementation work only with socket.io-client version 2.
That what you need to do on the fronted side:
npm i socket.io-client@v2-latest
After that use this code for starting point:
I hope this help for anyone. But anyway - wiki must be updated or laravel-swoole package must be updated to actual state.