soketi / echo-server

Echo Server is a Docker-ready, multi-scalable Node.js application used to host your own Socket.IO server for Laravel Broadcasting.
MIT License
32 stars 5 forks source link

Is it possible to use it with a backend that is not Laravel? #46

Closed elbojoloco closed 3 years ago

elbojoloco commented 3 years ago

This project seems to be exactly what I need, but I don't want to be stuck with only being able to use laravel backends. It is pusher compatible, but I have not found a way to change the API host that Pusher-server uses by default. You can only configure the cluster.

rennokki commented 3 years ago

There is no way to do this as the project is a mesh between a Socket.IO server (and frontend apps must connect using Socket.IO clients; more specific: https://github.com/soketi/soketi-js) and a Pusher-compatible HTTP REST API.

I researched a bit if Socket.IO can be customized to accept a Pusher client to connect and failed so far. If this can be done, I'd be happy to drop soketi-js support in favor of Pusher-compatible Websockets and also REST API, as an alternative to Pusher.

rennokki commented 3 years ago

@elbojoloco It took me less than 3 days to build a working Pusher-like server using https://github.com/uNetworking/uWebSockets.js

It's just with basic drivers and functionalities from this project, but soon it will be public. 🤓

elbojoloco commented 3 years ago

@rennokki actually, my question was focussed on back-end / soketi connection. And I found that you can easily configure pusher-server to use a different host. Nodejs example:

const Pusher = require("pusher")

const socket = new Pusher({
    appId: "echo-app-id",
    key: "echo-app-key",
    secret: "echo-app-secret",
    host: "127.0.0.1", 
    port: 6001,
})

// Trigger an event
socket.trigger(channel, event, data)