Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Change ping to an explicit message rather than ws protocol frame #808

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/Slackbot_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ module.exports = function(botkit, config) {
return;
}

bot.rtm.ping(null, null, true);
bot.msgcount++;
bot.rtm.send(JSON.stringify({ id: bot.msgcount, type: 'ping' }));
pingTimeoutId = setTimeout(pinger, 5000);
};

Expand All @@ -207,7 +208,7 @@ module.exports = function(botkit, config) {
* but adds in additional fields for internal use!
* (including the teams api details)
*/
if (message != null && bot.botkit.config.rtm_receive_messages) {
if (message != null && bot.botkit.config.rtm_receive_messages && message.type !== 'pong') {
botkit.receiveMessage(bot, message);
}
});
Expand Down