Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Slack Socket Mode #414

Open
chi-block opened this issue Jul 6, 2022 · 10 comments
Open

Add support for Slack Socket Mode #414

chi-block opened this issue Jul 6, 2022 · 10 comments

Comments

@chi-block
Copy link

Since Real Time Messaging API is not usable in new Slack apps, will the Socket Mode be supported in the future?

@dblock dblock changed the title Will Slack Socket Mode be supported since RTM API are outdated? Add support for Slack Socket Mode Jul 6, 2022
@dblock
Copy link
Collaborator

dblock commented Jul 6, 2022

It sure can. Please contribute!

@gmhawash
Copy link

gmhawash commented Nov 28, 2022

@dblock Slack Socket mode does not appear to give an equivalent functionality to what RTM used to do. With RTM, I had a production, staging and preview servers, and each used RTM to monitor a single channel. When a message was typed in that channel ALL of these clients received the message, and one of them handles the message based on a prefix in the message .production {command}, .staging {command}, or .preview {command}. With Socket mode, I have a similar setup with a client in each environment, but it looks like a message is only sent to ONE server, and not to ALL. Is there a way to get socket mode to broadcast to all listners, rather than select one of them?

@dblock
Copy link
Collaborator

dblock commented Nov 28, 2022

@gmhawash I've never used Slack socket mode, sorry :(

@chrisbloom7
Copy link
Collaborator

chrisbloom7 commented Dec 13, 2022

@gmhawash I'm not an expert on socket mode by any means, but I think the answer to your question is no. You can have multiple connections over socket mode for resiliency, but only one connection will be sent any given message.

https://api.slack.com/apis/connections/socket-implement#connections

@chrisbloom7
Copy link
Collaborator

To the more general issue, socket mode is supported in the sense that the client implements apps_connections_open which will return a temporary socket mode URL (api docs) which you can then connect to to monitor for new messages. How you make that connection and what you do with those messages will be entirely app dependent. Here's an example that uses Async::Websockets https://gist.github.com/chrisbloom7/52bc954b4df09b9cb829a73cfd5466c0

@gmhawash
Copy link

@chrisbloom7 thanks. It appears that the old RTM broadcast ability is not supported and that SocketMode only supports the ability for scalability or resiliency, where you can setup multiple listeners and one of them will get the message. I had relied on the old RTM broadcast for my implementation, now I might have to implement an app for each environment.

@dblock
Copy link
Collaborator

dblock commented Dec 14, 2022

For this library for socket mode support we'd want a higher level events handling interface where you can register events and they get routed automatically.

@ook
Copy link

ook commented Aug 22, 2023

Hi @dblock and @chrisbloom7 , I'm considering adding websocket support to slack-ruby-client. Would you prefer a support based on event-machine or on async gems? Some other requirements on your side? Thank you.

@dblock
Copy link
Collaborator

dblock commented Aug 22, 2023

I would say async. It's used in https://github.com/slack-ruby/slack-ruby-bot-server-rtm.

I would look into not bolting something into this library though, because you don't want to drag async into applications that only use web APIs. Maybe a new slack-ruby-client-sockets lib?

@ook
Copy link

ook commented Aug 22, 2023

@dblock deal. I'll mimic web implementation as far as I'll could.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants