RTippin / messenger-ui

Ready-made UI and web routes for core rtippin/messenger.
MIT License
14 stars 14 forks source link

config socket.io #8

Closed Pham-Thanh-Truong closed 1 year ago

Pham-Thanh-Truong commented 1 year ago

hi, this is a very good package and i like it, but i want to use socket.io and laravel-echo-server as an alternative to pusher, how to configure it, looking forward to your reply

Pham-Thanh-Truong commented 1 year ago

thanks for your suggestion, i can use laravel-websockets instead of pusher. And I am thinking of using firebase, so does this package have support for firebase? looking forward to your reply 😊

RTippin commented 1 year ago

The core messenger package is agnostic as far as the BROADCAST_DRIVER in the consuming app is concerned. This UI package only has pusher.js bundled, so only pusher protocol is supported by default. See: https://github.com/RTippin/messenger-ui/blob/0ac78019ca1002f9f6d55bb2bcce56c6a5e2224c/package.json#L35

https://github.com/RTippin/messenger-ui/blob/0ac78019ca1002f9f6d55bb2bcce56c6a5e2224c/resources/js/managers/NotifyManager.js#L9

https://github.com/RTippin/messenger-ui/blob/0ac78019ca1002f9f6d55bb2bcce56c6a5e2224c/resources/js/managers/NotifyManager.js#L130-L172

This means that pusher.com, laravel-websockets, or soketi should all work, as they use the pusher protocol.

If you did have a need to use your own socket.io instance, then you will need to fork this package. Once forked, update the NotifyManager as shown above, including importing socket.io in the package.json, then recompile the app.js/css and push your changes to your fork. Then overwrite the app.js/css files you compiled into your parent app, preferably by installing your forked repo of this package.