Sign In Register

How can we help you today?

Start a new topic

GetRTSession().SendData cant work

 I send a packet with opcode 0 to the server but it is not sent!

I initialize data variable, add GameSparksRTUnity,..

and I have no error. I read game Tank example and implemented my game like it:

in unity

public void send(){

GameSparksManager.get_instance().GetRTSession().SendData((0,GameSparksRT.DeliveryIntent.RELIABLE, data);// send the data


private void OnPacketReceived(RTPacket _packet)
  switch (_packet.OpCode)
  case 0:


in RT script cloud code:


  if(totalPlayers === 0){

  totalPlayers = response.opponents.length + 1; // we add one to this because the opponents list doesn't include us

  // first we check to see if the player has already joined the match
  if(!contains(player.getPeerId(), playersJoined)){
  playersJoined.push(player.getPeerId()); // and add them if not
  // next we check to see the max (or min) number of players has joined that match
  if(playersJoined.length === totalPlayers){
  RTSession.newPacket().setOpCode(100).setReliable(true).setTargetPeers().send(); // send an empty pack back to all players
  RTSession.newPacket().setOpCode(200).setReliable(false).setTargetPeers().send(); // send an empty pack back to all players
  RTSession.newPacket().setOpCode(300).setReliable(true).setTargetPeers().send(); // send an empty pack back to all players
  RTSession.newPacket().setOpCode(400).setReliable(true).setTargetPeers().send(); // send an empty pack back to all players


RTSession.onPacket(0, function(packet){

I don't see any print log in unity sent from OnPacketReceived!

Note a match has been found and I see a correct log and packet data onPlayerConnect(100,200,300,400)

"Match found"

"Starting session"

"GSM RT session Connected..."





I send data after RT session Connected.

2 people have this question

Hi Mahd,

This is being handled in the ticketing system.



I belive that opcode 0 just doesn't work. I don't know why, it should but try opcode 1

Login to post a comment