Package org.java_websocket.framing

Examples of org.java_websocket.framing.FramedataImpl1


    @Override
    public void run() {

      // log.debug("Keep-Alive ping sent.");
      FramedataImpl1 frame = new FramedataImpl1(Opcode.PING);
      frame.setFin(true);
      exchangeEventProducer.getConnection().sendFrame(frame);
    }
View Full Code Here


      try {
        onMessage(Charsetfunctions.stringUtf8(getLastFragmentedMessage().getPayloadData()));
      } catch (InvalidDataException e) {
        throw new ExchangeException("Invalid data recieved");
      }
      splitFrame = new FramedataImpl1();
    }
  }
View Full Code Here

  }

  public Framedata getLastFragmentedMessage() {

    Framedata returnFrame = splitFrame;
    splitFrame = new FramedataImpl1();
    return returnFrame;
  }
View Full Code Here

    return Collections.singletonList( (Framedata) curframe );
  }

  @Override
  public List<Framedata> createFrames( String text, boolean mask ) {
    FrameBuilder curframe = new FramedataImpl1();
    try {
      curframe.setPayload( ByteBuffer.wrap( Charsetfunctions.utf8Bytes( text ) ) );
    } catch ( InvalidDataException e ) {
      throw new NotSendableException( e );
    }
    curframe.setFin( true );
    curframe.setOptcode( Opcode.TEXT );
    curframe.setTransferemasked( mask );
    return Collections.singletonList( (Framedata) curframe );
  }
View Full Code Here

    FrameBuilder frame;
    if( optcode == Opcode.CLOSING ) {
      frame = new CloseFrameBuilder();
    } else {
      frame = new FramedataImpl1();
      frame.setFin( FIN );
      frame.setOptcode( optcode );
    }
    payload.flip();
    frame.setPayload( payload );
View Full Code Here

   *
   * @see org.java_websocket.WebSocketListener#onWebsocketPing(WebSocket, Framedata)
   */
  @Override
  public void onWebsocketPing( WebSocket conn, Framedata f ) {
    FramedataImpl1 resp = new FramedataImpl1( f );
    resp.setOptcode( Opcode.PONG );
    conn.sendFrame( resp );
  }
View Full Code Here

      continuousFrameType = Opcode.CONTINUOUS;
    } else {
      continuousFrameType = op;
    }

    FrameBuilder bui = new FramedataImpl1( continuousFrameType );
    try {
      bui.setPayload( buffer );
    } catch ( InvalidDataException e ) {
      throw new RuntimeException( e ); // can only happen when one builds close frames(Opcode.Close)
    }
    bui.setFin( fin );
    if( fin ) {
      continuousFrameType = null;
    } else {
      continuousFrameType = op;
    }
View Full Code Here

    throw new RuntimeException( "not yet implemented" );
  }

  @Override
  public List<Framedata> createFrames( String text, boolean mask ) {
    FrameBuilder frame = new FramedataImpl1();
    try {
      frame.setPayload( ByteBuffer.wrap( Charsetfunctions.utf8Bytes( text ) ) );
    } catch ( InvalidDataException e ) {
      throw new NotSendableException( e );
    }
    frame.setFin( true );
    frame.setOptcode( Opcode.TEXT );
    frame.setTransferemasked( mask );
    return Collections.singletonList( (Framedata) frame );
  }
View Full Code Here

          throw new InvalidFrameException( "unexpected END_OF_FRAME" );
        // currentFrame will be null if END_OF_FRAME was send directly after
        // START_OF_FRAME, thus we will send 'null' as the sent message.
        if( this.currentFrame != null ) {
          currentFrame.flip();
          FramedataImpl1 curframe = new FramedataImpl1();
          curframe.setPayload( currentFrame );
          curframe.setFin( true );
          curframe.setOptcode( Opcode.TEXT );
          readyframes.add( curframe );
          this.currentFrame = null;
          buffer.mark();
        }
        readingState = false;
View Full Code Here

    return buf;
  }

  @Override
  public List<Framedata> createFrames( ByteBuffer binary, boolean mask ) {
    FrameBuilder curframe = new FramedataImpl1();
    try {
      curframe.setPayload( binary );
    } catch ( InvalidDataException e ) {
      throw new NotSendableException( e );
    }
    curframe.setFin( true );
    curframe.setOptcode( Opcode.BINARY );
    curframe.setTransferemasked( mask );
    return Collections.singletonList( (Framedata) curframe );
  }
View Full Code Here

TOP

Related Classes of org.java_websocket.framing.FramedataImpl1

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.