snake unsubscription fixes

This commit is contained in:
Benjamin Sergeant 2019-09-05 20:47:15 -07:00
parent eeefc9cf4b
commit 21404c23dd
2 changed files with 8 additions and 2 deletions

View File

@ -192,7 +192,7 @@ namespace ix
{
if (!handleUnsubscriptionResponse(data))
{
invokeErrorCallback("Error processing subscribe response", msg->str);
invokeErrorCallback("Error processing unsubscribe response", msg->str);
}
}
else if (action == "rtm/unsubscribe/error")

View File

@ -287,12 +287,18 @@ namespace snake
const AppConfig& appConfig,
const nlohmann::json& pdu)
{
// extract subscription_id
auto body = pdu["body"];
auto subscriptionId = body["subscription_id"];
state->redisClient().stop();
nlohmann::json response = {
{"action", "rtm/unsubscribe/ok"},
{"id", pdu.value("id", 1)},
{"body", {}}
{"body", {
{"subscription_id", subscriptionId}
}}
};
ws->sendText(response.dump());
}