Problem with appwarp multiplayer

Hi,

i’m trying to integrate appwarp with my game.
The problem is that when i send a message, it doesn’t get triggered the listener ‘onUpdatePeersReceived’ nor the ‘onSendUpdatePeers’. 
 
So i’m sending in a loop the message until is not received. This is a waste of resources and i was wondering where is the bug and if you can help me.
 
Here is the source code.

Thank you

----- Main.lua -------------------- local physics = require( "physics" ) physics.start() -- do the appwarp client related handling in a separate file require "warplisteners" -- IMPORTANT! loop WarpClient. This is required for receiving responses and notifications local function gameLoop(event) appWarpClient.Loop() end Runtime:addEventListener("enterFrame", gameLoop) statusText = display.newText( "Connecting..", 10, display.contentHeight, native.systemFontBold, 24 ) statusText.width = 128 playerName = nil ownerName = "owner" local function setPlayerName() local scelta = math.random(0,1) if scelta == 1 then playerName = "owner" else playerName = "altro" end end scelta = nil spawned = false ricevuto = false local function new( moltiplicatore, scelta ) local shuriken = {} local name = "bullet" local scelta = scelta or math.random(1,5) if scelta == 1 or scelta == 2 then shuriken = display.newImageRect( "Icon.png", 30 , 30 ) shuriken.name = "freeze " .. name physics.addBody( shuriken, "dinamic", {radius = 15, bounce = 0, isSensor = true} ) shuriken:applyTorque( -0.5 ) else shuriken = display.newImageRect( "Icon.png", 30, 30 ) shuriken.name = "fire " .. name physics.addBody( shuriken, "dinamic", {radius = 15, bounce = 0, isSensor = true} ) shuriken:applyTorque( -0.5 ) end shuriken.isBullet = true shuriken.hit = false shuriken.x = 500 shuriken.y = scelta \* 20 -- math.random( 20, 200 ) shuriken.gravityScale = 0 shuriken:setLinearVelocity(-50\*moltiplicatore,0) return shuriken, scelta end local function spawnBullet() if ownerName == playerName and not spawned then print("owner spawn") \_, scelta = new( 1 ) messaggio = tostring(scelta) .. " " .. tostring (math.random(1000)) ricevuto = false spawned = true --appWarpClient.sendUpdatePeers(messaggio) elseif scelta and ricevuto then print("altro spawn") new( 1, scelta) spawned = true ricevuto = false end end local i = 0 local function loop () if not spawned then spawnBullet() end if not ricevuto and playerName == ownerName and spawned then appWarpClient.sendUpdatePeers(messaggio) end end setPlayerName() print( playerName ) -- start connecting with a random name appWarpClient.connectWithUserName(playerName) Runtime:addEventListener("enterFrame", loop) timer.performWithDelay(10000, function () if playerName == ownerName then spawned = false end end, 0) 

---------------- warplistener.lua ----------------------------- -- create global warp client and initialize it appWarpClient = require "AppWarp.WarpClient" API\_KEY = "" SECRET\_KEY = "" STATIC\_ROOM\_ID = "" appWarpClient.initialize(API\_KEY, SECRET\_KEY) function onJoinRoomDone(resultCode) if(resultCode == WarpResponseResultCode.SUCCESS) then appWarpClient.subscribeRoom(STATIC\_ROOM\_ID) statusText.text = "Subscribing to room.." else statusText.text = "Room Join Failed" end end function onSubscribeRoomDone(resultCode) if(resultCode == WarpResponseResultCode.SUCCESS) then statusText.text = "Started!" else statusText.text = "Room Subscribe Failed" end end function onConnectDone(resultCode) if(resultCode == WarpResponseResultCode.SUCCESS) then statusText.text = "Joining Room.." appWarpClient.joinRoom(STATIC\_ROOM\_ID) elseif(resultCode == WarpResponseResultCode.AUTH\_ERROR) then statusText.text = "Incorrect app keys" else statusText.text = "Connect Failed. Restart" end end function onSendUpdatePeersDone (resultCode ) print("resultCode: " .. tostring (resultCode)) if(resultCode == WarpResponseResultCode.SUCCESS) then ricevuto = true end end lastSequence = -1 function onUpdatePeersReceived(update) print ("update: " .. update) local func = string.gmatch(update, "%S+") local updateScelta = func() local newSequence = func() if (not ricevuto) and (newSequence ~= lastSequence) and not (playerName == ownerName) then scelta = tonumber( updateScelta ) lastSequence = newSequence spawned = false ricevuto = true end end appWarpClient.addRequestListener("onConnectDone", onConnectDone) appWarpClient.addRequestListener("onJoinRoomDone", onJoinRoomDone) appWarpClient.addRequestListener("onSubscribeRoomDone", onSubscribeRoomDone) appWarpClient.addRequestListener("onSendUpdatePeersDone", onSendUpdatePeersDone) appWarpClient.addNotificationListener("onUpdatePeersReceived", onUpdatePeersReceived)

I’ve solved the problem. My error was to send the first messages without having the connection setted.

May I ask if you are attempting to create a multiplayer game with this?  Would love to hear more,thanks.

I’m stil working on it, the code above it’s just a test for now.

Actually i’m working on a game for an university project and i was planning the introduction of a multiplayer mode.

In this week i will try to place dynamic rooms and if all things work fine, i will integrate in the game.

How is the multiplayer game coming along?

I’ve solved the problem. My error was to send the first messages without having the connection setted.

May I ask if you are attempting to create a multiplayer game with this?  Would love to hear more,thanks.

I’m stil working on it, the code above it’s just a test for now.

Actually i’m working on a game for an university project and i was planning the introduction of a multiplayer mode.

In this week i will try to place dynamic rooms and if all things work fine, i will integrate in the game.

How is the multiplayer game coming along?