Package com.google.appengine.api.channel

Examples of com.google.appengine.api.channel.ChannelMessage


    // And the other has the same friend
    oam.addFriend(action.getEmail(), user.getEmail());
   
    String json = toJson.getJson(null, user.getEmail(), MessageType.addContact);
    ChannelService channelService = ChannelServiceFactory.getChannelService();
    channelService.sendMessage(new ChannelMessage(action.getEmail(), json));
    return new AddFriendResult(result);
  }
View Full Code Here


    String encodedMessage = encodeMessage(msg);
    for (String userUniqueId : userUniqueIds) {
      String key = getAppKeyForUser(userUniqueId);
      logger.info("Pushing msg to " + key);
      try {
        getChannelService().sendMessage(new ChannelMessage(key, encodedMessage));
      } catch (Exception e) {
        // [The original google example code notes here:
        // A bug in the dev_appserver causes an exception to be
        // thrown when no users are connected yet.]
        logger.log(Level.SEVERE, "Failed to push the message " + msg + " to client " + key, e);
View Full Code Here

              return false;
            }
          });

      ChannelServiceFactory.getChannelService().sendMessage(
          new ChannelMessage(channel, serialized));
    } catch (SecurityException e) {
      e.printStackTrace();
    } catch (NoSuchMethodException e) {
      e.printStackTrace();
    } catch (SerializationException e) {
View Full Code Here

    } else {
      // send msg
      ChannelService channelService = ChannelServiceFactory.getChannelService();
      logger.info("sending msg : client id = " + clientId);
      logger.info("sending msg size = " + msg.length());
      channelService.sendMessage(new ChannelMessage(clientId, msg))
    }
  }
View Full Code Here

      Util.jsonPut(matchMsg, "object", matchedObject);
      Util.jsonPut(matchMsg, "queryIds", new JSONArray(queryIds));
      logger.fine("MatchResponseServlet: delivering json: " + matchMsg);

      ChannelServiceFactory.getChannelService()
          .sendMessage(new ChannelMessage(endpointId, "(" + matchMsg + ")"));
    }
  }
View Full Code Here

                .asKeyList();
        ChannelService channelService =
            ChannelServiceFactory.getChannelService();
        String memoJson = MemoMeta.get().modelToJson(memo);
        for (Key channel : channels) {
            channelService.sendMessage(new ChannelMessage(
                channel.getName(),
                memoJson));
        }
    }
View Full Code Here

    String message = req.getParameter("message");
   
    //Send a message based on the 'channelKey' any channel with this key will receive the message
    ChannelService channelService = ChannelServiceFactory.getChannelService();
   
  channelService.sendMessage(new ChannelMessage(channelKey, message));
  }
View Full Code Here

  }

  private void sendData(ClientId clientId, String data) {
    log.info("Sending to " + clientId + ", " + Util.abbrev(data, 50));
    try {
      channelService.sendMessage(new ChannelMessage(clientId.getId(), data));
    } catch (ChannelFailureException e) {
      // Channel service is best-effort anyway, so it's safe to discard the
      // exception after taking note of it.
      log.log(Level.SEVERE, "Channel service failed for " + clientId, e);
    }
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));
    }
   
  }
View Full Code Here

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

TOP

Related Classes of com.google.appengine.api.channel.ChannelMessage

Copyright © 2018 www.massapicom. 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.