Hi all,
I’m currently developing online turn based game. I use PubNub for cloud system.
Here is the problem:
require "pubnub"
multiplayerServer = pubnub.new({
publish\_key = "publish\_key", -- YOUR PUBLISH KEY
subscribe\_key = "subscribe\_key", -- YOUR SUBSCRIBE KEY
secret\_key = "secret\_key", -- YOUR SECRET KEY
ssl = nil, -- ENABLE SSL?
origin = "pubsub.pubnub.com" -- PUBNUB CLOUD ORIGIN
})
multiplayerServer:subscribe({
channel = "testChannel",
callback = function(message)
print(Json.Encode(message) .. " - 1")
end,
errorback = function()
print("Network Connection Lost")
end
})
multiplayerServer:unsubscribe({channel = "testChannel"})
multiplayerServer:subscribe({
channel = "testChannel",
callback = function(message)
print(Json.Encode(message) .. " - 2")
end,
errorback = function()
print("Network Connection Lost")
end
})
As you see in the first callback method " - 1" is added to end of the message and in the second callback method " - 2" is added to end of the message.
When I send a message from the console this what I’ve got:
{"text":"hey"} - 1
{"text":"hey"} - 2
Isn’t this a problem? When I unsubscribe PubNub doesn’t forget the old callback function.
Any ideas? [import]uid: 5629 topic_id: 24509 reply_id: 324509[/import]