RTippin / messenger

Laravel messenger. A full messenger suite for your new / existing laravel app! Private and group threads between multiple models, with real-time messaging, reactions, attachments, calling, chat bots, and more!
https://tippindev.com
MIT License
417 stars 84 forks source link

Is there any way to use that Script without Pusher ??? #60

Closed chegmarco1989 closed 1 year ago

chegmarco1989 commented 1 year ago

hELLO.

Is there any way to use that Script without "Pusher" but just with an Open Source Project THAT COULD REPLACE "Pusher" ???

Please, answer. Awaiting your answer.

darkfrozenfire commented 1 year ago

Hi, Only websocket was there earlier before to replace pusher @RTippin bro confirm whether it will be replaced.

chegmarco1989 commented 1 year ago

Hi @darkfrozenfire and thanks for replying.

How to use and install websocket instead of Pusher in that Messenger-Demo (https://github.com/RTippin/messenger-demo) ???

Hope your answer ???!!!

darkfrozenfire commented 1 year ago

https://beyondco.de/docs/laravel-websockets/getting-started/introduction/

RTippin commented 1 year ago

@chegmarco1989 This core backend package, rtippin/messenger is configurable with any broadcast driver that laravel supports, as I only configure the channel names and broadcast auth endpoints, but the consuming app can use any driver.

https://github.com/RTippin/messenger/blob/83bb92d1e7ec1b87838179fe80cbac6658b37c0d/src/ChannelMap.php#L25-L50

My optional frontend UI package, rtippin/messenger-ui is only setup to import pusherjs, thus I document how to use pusher or laravel-websockets in its readme:

https://github.com/RTippin/messenger-ui/blob/master/README.md#using-laravel-websockets

If you want to use something other than pusherjs, you may fork the frontend, edit the necessary JS, and re-compile the assets to publish within your app. Unfortunately, I have no plans right now to change anything in my messenger* packages until I find the time to dedicate to version 2.

https://github.com/RTippin/messenger-ui/issues/10

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

https://github.com/RTippin/messenger-ui/blob/f47924acb9dc3c5aadfc1479b6711e1397b69d91/resources/js/managers/NotifyManager.js#L130-L211

chegmarco1989 commented 1 year ago

Hi all especially @RTippin and @darkfrozenfire .

But I'm confusing about how to setup .env file:

.env keys for both laravel-websockets and our UI

BROADCAST_DRIVER= ???
PUSHER_APP_ID= ???
PUSHER_APP_KEY= ???
PUSHER_APP_SECRET= ???
MESSENGER_SOCKET_HOST= ???
MESSENGER_SOCKET_KEY="???"

How to set these above informations if I don't want to use or use anymore Pusher ??? Please explain me how to use them with Websocket informations ??? Could you give an example for using them with Websocket ???

If I put anything there, will it make the Websocket work or do I necessarily have to have an account on Pusher to fill in this information afterwards (But since Pusher is no longer necessary) ???

Please, I really need your help.

RTippin commented 1 year ago

@chegmarco1989 Please refer to the official Laravel docs and app skeleton to see what those values reference.

https://laravel.com/docs/10.x/broadcasting https://github.com/laravel/laravel/blob/f419821bd8cbc736ac6f9b2fce75a4e373a4b49f/config/broadcasting.php#L33-L67

The config values in my messenger-ui simply forward their values to the view file to inject into the notifymanager js file I linked in my earlier reply.

https://github.com/RTippin/messenger-ui/blob/f47924acb9dc3c5aadfc1479b6711e1397b69d91/config/messenger-ui.php#L19-L27

https://github.com/RTippin/messenger-ui/blob/master/resources/views/scripts.blade.php#L33-L48

chegmarco1989 commented 1 year ago

Thanks @RTippin But I'm still confuse.

I just want to know if YES, it is necessarily to create an account on Pusher.com if I decided to use Websoket ??? Or if NO, it is not necessarily and I can put there anything which not from Pusher.com ???

RTippin commented 1 year ago

If you use laravel-websockets package, then no, you do not need an official pusher account. It is a drop-in replacement for the real pusher. My tippindev.com demo is using laravel-websockets and not pusher.com. For that, you are making up your own app credentials to fill in for the pusher driver. Please see the readme I linked above from the messenger-ui repo above, as it explains what you need to change when installing laravel-websockets

chegmarco1989 commented 1 year ago

Thanks for all. Great thanks