Examples of TextWebSocketFrame


Examples of io.netty.handler.codec.http.websocketx.TextWebSocketFrame

    return channel.isConnected();
  }

  @Override
  public void write(String data) {
    channel.write(new TextWebSocketFrame(data));
  }
View Full Code Here

Examples of io.netty.handler.codec.http.websocketx.TextWebSocketFrame

  private String getWebSocketLocation(final HttpRequest req) {
    return "ws://" + req.getHeader(HttpHeaders.Names.HOST) + WEBSOCKET_PATH;
  }

  public static void sendMessage(final ChannelHandlerContext ctx, final String message) {
    ctx.getChannel().write(new TextWebSocketFrame(message));
  }
View Full Code Here

Examples of io.netty.handler.codec.http.websocketx.TextWebSocketFrame

    if (!queueRunning) {
      throw new QueueUnavailableException("queue is not available");
    }

    if (useDirectSocketChannel && directSocketChannel.isConnected()) {
      directSocketChannel.write(new TextWebSocketFrame("[" + ServerBusTools.encodeMessage(message) + "]"));
    }
    else {
      try {
        if (pagedOut) {
          try {
View Full Code Here

Examples of io.netty.handler.codec.http.websocketx.TextWebSocketFrame

  public void wake() {
    try {
      if (isDirectChannelOpen()) {
        UnwrappedByteArrayOutputStream outputStream = new UnwrappedByteArrayOutputStream();
        buffer.read(outputStream, bufferColor, new BufferHelper.MultiMessageHandlerCallback());
        directSocketChannel.write(new TextWebSocketFrame(new String(outputStream.toByteArray(), 0, outputStream.size())));
      }
      else {
        BufferHelper.encodeAndWriteNoop(buffer, bufferColor);
      }
View Full Code Here

Examples of io.netty.handler.codec.http.websocketx.TextWebSocketFrame

    public void setup(ChannelHandlerContext context){
        this.context = context;
    }

    public void write(String data){
        context.channel().write(new TextWebSocketFrame(data));
    }
View Full Code Here

Examples of io.netty.handler.codec.http.websocketx.TextWebSocketFrame

    if (!queueRunning) {
      throw new QueueUnavailableException("queue is not available");
    }

    if (useDirectSocketChannel && directSocketChannel.isConnected()) {
      directSocketChannel.write(new TextWebSocketFrame("[" + ServerBusTools.encodeMessage(message) + "]"));
    }
    else {
      try {
        if (pagedOut) {
          try {
View Full Code Here

Examples of io.netty.handler.codec.http.websocketx.TextWebSocketFrame

  public void wake() {
    try {
      if (isDirectChannelOpen()) {
        UnwrappedByteArrayOutputStream outputStream = new UnwrappedByteArrayOutputStream();
        buffer.read(outputStream, bufferColor, new BufferHelper.MultiMessageHandlerCallback());
        directSocketChannel.write(new TextWebSocketFrame(new String(outputStream.toByteArray(), 0, outputStream.size())));
      }
      else {
        BufferHelper.encodeAndWriteNoop(buffer, bufferColor);
      }
View Full Code Here

Examples of io.netty.handler.codec.http.websocketx.TextWebSocketFrame

  private String getWebSocketLocation(HttpRequest req) {
    return "ws://" + req.getHeader(HttpHeaders.Names.HOST) + WEBSOCKET_PATH;
  }

  public static void sendMessage(ChannelHandlerContext ctx, String message) {
    ctx.getChannel().write(new TextWebSocketFrame(message));
  }
View Full Code Here

Examples of io.netty.handler.codec.http.websocketx.TextWebSocketFrame

      Object value = cache.get(key);

      JsonObject responseObject = toJSON(key, value, cache.getName());

      // Write the JSON response out onto the channel...
      ctx.channel().writeAndFlush(new TextWebSocketFrame(responseObject.toString()));
   }
View Full Code Here

Examples of io.netty.handler.codec.http.websocketx.TextWebSocketFrame

    String jsonString = jsonObject.toString();
    for(ChannelNotifyParams channel : channels) {
      if(channel.channel.isOpen() && channel.onEvents.contains(eventType)) {
        if(channel.key != null) {
          if(event.getKey().equals(channel.key) || channel.key.equals("*")) {
            channel.channel.writeAndFlush(new TextWebSocketFrame(jsonString));
          }
        } else {         
          channel.channel.writeAndFlush(new TextWebSocketFrame(jsonString));
        }
      }
    }
  }
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.