Suggestion: use middlerware pattern for socketmode
With the current implementation for socketmode we need to systematically create an event loop link in the example:
https://github.com/slack-go/slack/blob/master/examples/socketmode/socketmode.go. It is very verbose and requires duplicating that code in all our project. I was thinking of adding a socketmodeHandler that follows the middleware design pattern.
This is a design choice so I wanted to discuss the idea before submitting a PR. As a matter of fact, I could also create a separate library, but why no including it directly in slack-go?
An example of how we would use such implementation
socketmodeHandler:= socketmode.NewsSocketmodeHandler()
socketmodeHandler.Handle(socketmode.EventTypeConnecting, middlewareOne(middlewareTwo(finalHandler)))
@xNok Sorry for slow response. Currently, there are very few active maintainers of this library, so there are some concerns (for example expanding the area that needs to be maintained). How about including this suggestion as an experimental feature? (Personally, I think your suggestion is a good idea. I also think it would be nice to have a framework like Bolt provided by an official.)
For sure, it would be nice if Slack were maintaining a similar library. I am ok with It to be an experimental feature, I am willing to maintain that feature and everything that is related to Socket Mode (use the SocketMode tag or mention me if needed).
I am providing a tutorial repository on the side so you can be sure I will be looking into most of Slack features. https://github.com/xNok/slack-go-demo-socketmode. It will an extra layer of test for this library.
Thanks. I'll confirm your PR as soon as possible.