Package com.google.appengine.api.channel

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


    oam.removeContact(user.getEmail(), action.getEmail(), action.isPending());
    // Pending contacts exists only in one user, but contacts in two
    if(!action.isPending()){
      oam.removeContact(action.getEmail(), user.getEmail(), false);
      String json = toJson.getJson(null, user.getEmail(), MessageType.removeContact);
      ChannelService channelService = ChannelServiceFactory.getChannelService();
      channelService.sendMessage(new ChannelMessage(action.getEmail(), json));
    }
    return new RemoveContactResult();
  }
View Full Code Here


    result = oam.addFriend(user.getEmail(), action.getEmail());
    // 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

  @Override
  public CreateTokenResult execute(CreateToken action, ExecutionContext context)
      throws ActionException {
    UserService userService = UserServiceFactory.getUserService();
      String userId = userService.getCurrentUser().getEmail();
      ChannelService channelService = ChannelServiceFactory.getChannelService();
      String token = channelService.createChannel(userId, MINUTES);
    return new CreateTokenResult(token);
  }
View Full Code Here

          sendMsg(clientId, AutoBeanUtil.encode(Result.class, result));
        }
      }
    } 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

  public String generateChannel() {
    Random generator = new Random(Calendar.getInstance().getTimeInMillis());
    String userId = "clientId-" + generator.nextInt();
    // The 'Game' object exposes a method which creates a unique string based on the game's key
      // and the user's id.
    ChannelService channelService = ChannelServiceFactory.getChannelService();
    String token = channelService.createChannel(userId);
    this.connectedClients.add(userId);
    return token;
  }
View Full Code Here

        } catch (IllegalArgumentException e) {
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            return null;
        }
        String clientId = UUID.randomUUID().toString();
        ChannelService channelService =
            ChannelServiceFactory.getChannelService();
        String token = channelService.createChannel(clientId);
        MinutesChannel minutesChannel = new MinutesChannel();
        minutesChannel.setKey(Datastore.createKey(
            MinutesChannel.class,
            clientId));
        minutesChannel.setCreatedAt(new Date());
View Full Code Here

            Datastore
                .query(MinutesChannel.class)
                .filter(
                    MinutesChannelMeta.get().minutesKey.equal(memo.getMinutes()))
                .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

  public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    String channelKey = req.getParameter("channelKey");
    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

   
    String str = "[";
    str += "{\"newconnection\":\""+userID+"\",\"netNickname\":\""+userNickname+"\"}";
    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

      channelService.sendMessage(new ChannelMessage(channelKey, str));
    }
   
  }
  public void getNetNodes(String userID) {
    ChannelService channelService = ChannelServiceFactory.getChannelService();
    for(int n = 0; n < this.arrNetNodesIds.size(); n++) {
      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.ChannelService

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.