Package com.google.appengine.api.channel

Examples of com.google.appengine.api.channel.ChannelService.sendMessage()


      String str = "[";
      str += "{\"getNetNodesResponse\":\""+this.arrNetNodesIds.get(n)+"\",\"netNickname\":\""+this.arrNetNodesNicknames.get(n)+"\"}";
      str += "]";     
     
      String channelKey = getChannelKey(userID);
      channelService.sendMessage(new ChannelMessage(channelKey, str));
    }
  }
  public void dataclient(String userID, String userNickname, String param1) {
    String str = "[";
    str += "{\"serverNodeData\":\"true\",\"netID\":\""+userID+"\",\"netNickname\":\""+userNickname+"\",\"param1\":\""+param1+"\"}";
View Full Code Here


    str += "]";
   
    ChannelService channelService = ChannelServiceFactory.getChannelService();
    for(int n = 0; n < this.arrNetNodesIds.size(); n++) {   
      String channelKey = getChannelKey(this.arrNetNodesIds.get(n));
      channelService.sendMessage(new ChannelMessage(channelKey, str));
    }
  }
  public void disconnect(String userID, String userNickname) {
    String str = "[";
    str += "{\"disconnectNetNode\":\"true\",\"netID\":\""+userID+"\",\"netNickname\":\""+userNickname+"\"}";
View Full Code Here

    str += "]";
   
    ChannelService channelService = ChannelServiceFactory.getChannelService();
    for(int n = 0; n < this.arrNetNodesIds.size(); n++) {
      String channelKey = getChannelKey(this.arrNetNodesIds.get(n));
      channelService.sendMessage(new ChannelMessage(channelKey, str));
    }
   
    int idxToDel = 0;
    for(int n = 0; n < this.arrNetNodesIds.size(); n++) {  
      if(this.arrNetNodesIds.get(n).equals(userID)) {
View Full Code Here

   
    while(keys.hasMoreElements()){
      key = keys.nextElement();
      if( key.equals("123321")) continue;
      try{
        channelService.sendMessage(new ChannelMessage(key, message));
        channelService.sendMessage(new ChannelMessage(key, gsu));
      }catch(Exception e){
        e.printStackTrace();
      }
    }   
View Full Code Here

    while(keys.hasMoreElements()){
      key = keys.nextElement();
      if( key.equals("123321")) continue;
      try{
        channelService.sendMessage(new ChannelMessage(key, message));
        channelService.sendMessage(new ChannelMessage(key, gsu));
      }catch(Exception e){
        e.printStackTrace();
      }
    }   
  }
View Full Code Here

        userId = req.getParameter(Constant.USER_ID).toString();
        if(userMap.get(userId) == null)
          break;
        String ngToken = String.valueOf(UUID.randomUUID().getMostSignificantBits());
          channelService = ChannelServiceFactory.getChannelService();
          channelService.sendMessage(new ChannelMessage(userId, "{\""+Constant.MESSAGE_TYPE+"\":\""+Constant.NEW_GAME_TOKEN+"\"}"));
          channelService.sendMessage(new ChannelMessage(userId, gson.toJson(ngToken)))
          gameTokenList.put(ngToken, userId);
          break;
      case Constant.NEW_GAME:
        cBrd = CheckerModel.checkerBoard();
View Full Code Here

        if(userMap.get(userId) == null)
          break;
        String ngToken = String.valueOf(UUID.randomUUID().getMostSignificantBits());
          channelService = ChannelServiceFactory.getChannelService();
          channelService.sendMessage(new ChannelMessage(userId, "{\""+Constant.MESSAGE_TYPE+"\":\""+Constant.NEW_GAME_TOKEN+"\"}"));
          channelService.sendMessage(new ChannelMessage(userId, gson.toJson(ngToken)))
          gameTokenList.put(ngToken, userId);
          break;
      case Constant.NEW_GAME:
        cBrd = CheckerModel.checkerBoard();
        r = gson.toJson(cBrd);
View Full Code Here

          break;
      case Constant.CONNECTED_USER_LIST:
        userId = req.getParameter(Constant.USER_ID).toString();
        if( userMap.get(userId) != null){
              channelService = ChannelServiceFactory.getChannelService();
              channelService.sendMessage(new ChannelMessage(userId, "{\""+Constant.MESSAGE_TYPE+"\":\""+Constant.CONNECTED_USER_LIST+"\"}"));
              channelService.sendMessage(new ChannelMessage(userId, gson.toJson(userMap)));
        }else
          r = "You are not connected!!!";
        break;
    }   
View Full Code Here

      case Constant.CONNECTED_USER_LIST:
        userId = req.getParameter(Constant.USER_ID).toString();
        if( userMap.get(userId) != null){
              channelService = ChannelServiceFactory.getChannelService();
              channelService.sendMessage(new ChannelMessage(userId, "{\""+Constant.MESSAGE_TYPE+"\":\""+Constant.CONNECTED_USER_LIST+"\"}"));
              channelService.sendMessage(new ChannelMessage(userId, gson.toJson(userMap)));
        }else
          r = "You are not connected!!!";
        break;
    }   
    resp.getWriter().print(r)
View Full Code Here

       
        if( gm != null && gm.move(mtr, piece) == true){
          rId = gm.getUserId(userId);
          Checkers.log.info("++++++++++++GAME_MOVE    Sending Move to remote host id "+rId+"++++++++++++");
          channelService = ChannelServiceFactory.getChannelService();
          channelService.sendMessage(new ChannelMessage(rId, "{\""+Constant.MESSAGE_TYPE+"\":\""+Constant.GAME_MOVE+"\"}"));
            channelService.sendMessage(new ChannelMessage(rId, gson.toJson(mtr)));   
           
            if( gm.getMTable() == null ){
              channelService.sendMessage(new ChannelMessage(rId, "{\""+Constant.MESSAGE_TYPE+"\":\""+Constant.GAME_PLAY+"\"}"));
              channelService.sendMessage(new ChannelMessage(rId, gson.toJson(Constant.GAME_PLAY)));               
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.