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

Reconnection process #299

Open
jurepetrovic opened this issue Sep 27, 2022 · 4 comments
Open

Reconnection process #299

jurepetrovic opened this issue Sep 27, 2022 · 4 comments

Comments

@jurepetrovic
Copy link

jurepetrovic commented Sep 27, 2022

Hello,

when slack goes out of service, we sometimes get the following Null Pointer Exception:
Stack Trace: java.lang.NullPointerException at com.ullink.slack.simpleslackapi.impl.SlackJSONSessionStatusParser.parse(SlackJSONSessionStatusParser.java:71) at com.ullink.slack.simpleslackapi.impl.SlackWebSocketSessionImpl.connectImpl(SlackWebSocketSessionImpl.java:389) at com.ullink.slack.simpleslackapi.impl.SlackWebSocketSessionImpl.connect(SlackWebSocketSessionImpl.java:348)

Has anyone any idea how to do reconnection attempt properly here?

I looked here, but if slack service goes down, we don't get goodbye message.
#269

Thanks,
Jure

@ConnorLinfoot
Copy link

This error seems to be due to the RTM change deprecating the previous behavior of rtm.start and the new behavior not being supported by this library at the moment

@jurepetrovic
Copy link
Author

I used try/catch and then slack session builder to create autoreconnect SlackSession.
It solves the problem where the client loses connection, but not when server drops.

@ConnorLinfoot
How would you go about changing this behaviour? Where is rtm.start used?
What was the change on RTM?

I got used to simple-slack-api, otherwise works fine for me and is lightweight.
Would really like to solve this.

Thanks.
Jure

@ConnorLinfoot
Copy link

ConnorLinfoot commented Sep 28, 2022

I used try/catch and then slack session builder to create autoreconnect SlackSession. It solves the problem where the client loses connection, but not when server drops.

@ConnorLinfoot How would you go about changing this behaviour? Where is rtm.start used? What was the change on RTM?

I got used to simple-slack-api, otherwise works fine for me and is lightweight. Would really like to solve this.

Thanks. Jure

Personally, I moved to using the official slack java client, I did originally try updating this client but upon realizing master seemed to be half updated to the new socket mode system instead of RTM I chose to leave it. Depending on your use case it may be better to also adopt the official client, as its more likely to stay up to date and have more support around it (although the documentation is a bit lacking in my opinion)

@pmauduit
Copy link

Personally, I moved to using the official slack java client

Currently in the process of doing the same. I tried to use the current state of master yesterday, after having updated my app to the new way of interacting with the API (configuring scopes, adding an app token, configuring events to be sent to, reinstalling my app into my workspace...) but stumbled upon several problems:

  1. the ping/pong API does not work anymore, so the bot keeps disconnecting / reconnecting to Slack, I shunted the test in the WebSocket API class so that it stays connected (probably not the expected way of fixing things)
  2. the JSON payload received when an event occurs is not into the same format as the one expected earlier, we now need to object.get("payload").get("event") to find it back
  3. we now have to acknowledge every events received, which is not done here, so Slack keeps resending the events because of timeout

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

No branches or pull requests

3 participants