Examples of WampMessage


Examples of ch.rasc.wampspring.message.WampMessage

  @Override
  public void handleMessage(WebSocketSession session, WebSocketMessage<?> webSocketMessage) throws Exception {
    Assert.isInstanceOf(TextMessage.class, webSocketMessage);

    WampMessage message = WampMessage.fromJson(jsonFactory, ((TextMessage) webSocketMessage).getPayload());
    message.addHeader(WampMessageHeader.WEBSOCKET_SESSION_ID, session.getId());
    message.addHeader(WampMessageHeader.PRINCIPAL, session.getPrincipal());

    pubSubHandler.handleMessage(message);
    annotationMethodHandler.handleMessage(message);
  }
View Full Code Here

Examples of com.github.ghetolay.jwamp.message.WampMessage

        WampMessageSerializer.serialize(msg, serializer.getObjectMapper()));
  }
 
  @Test
  public void deserialize1() throws JsonParseException, SerializationException, IOException{
    WampMessage msg = WampMessageDeserializer.deserialize(serializer.getObjectMapper().getJsonFactory().createJsonParser(
        "[7,\"http://example.com/simple\",\"Hello, world!\"]"));
       
    if( !(msg instanceof WampPublishMessage) )
      fail("Wrong message type");
    assertEquals(WampMessage.PUBLISH, msg.getMessageType());
   
    WampPublishMessage pMsg = (WampPublishMessage)msg;
    assertEquals("http://example.com/simple", pMsg.getTopicId());
    assertEquals("Hello, world!", pMsg.getEvent());
  }
View Full Code Here

Examples of com.github.ghetolay.jwamp.message.WampMessage

        WampMessageSerializer.serialize(msg, serializer.getObjectMapper()));
  }
 
  @Test
  public void deserialize2() throws JsonParseException, SerializationException, IOException{
    WampMessage msg = WampMessageDeserializer.deserialize(serializer.getObjectMapper().getJsonFactory().createJsonParser(
        "[7,\"http://example.com/simple\", null]"));
       
    if( !(msg instanceof WampPublishMessage) )
      fail("Wrong message type");
    assertEquals(WampMessage.PUBLISH, msg.getMessageType());
   
    WampPublishMessage pMsg = (WampPublishMessage)msg;
    assertEquals("http://example.com/simple", pMsg.getTopicId());
    assertNull(pMsg.getEvent());
  }
View Full Code Here

Examples of com.github.ghetolay.jwamp.message.WampMessage

    );
  }
 
  @Test
  public void deserialize3() throws JsonParseException, SerializationException, IOException, ParseException{
    WampMessage msg = WampMessageDeserializer.deserialize(serializer.getObjectMapper().getJsonFactory().createJsonParser(
        "[7, \"http://example.com/event#myevent2\","
          "{"
                  +    "\"rand\": 0.09187032734575862,"
                  +    "\"flag\": false,"
                  +    "\"num\": 23,"
                  +    "\"name\":\"Kross\","
                  +    "\"created\": \"2012-03-29T10:41:09.864Z\""
                   "}]"
        ));
       
    if( !(msg instanceof WampPublishMessage) )
      fail("Wrong message type");
    assertEquals(WampMessage.PUBLISH, msg.getMessageType());
   
    WampPublishMessage pMsg = (WampPublishMessage)msg;
    assertEquals("http://example.com/event#myevent2", pMsg.getTopicId());
   
    Object event = pMsg.getEvent();
View Full Code Here

Examples of com.github.ghetolay.jwamp.message.WampMessage

        WampMessageSerializer.serialize(msg, serializer.getObjectMapper()));
  }
 
  @Test
  public void deserialize4() throws JsonParseException, SerializationException, IOException{
    WampMessage msg = WampMessageDeserializer.deserialize(serializer.getObjectMapper().getJsonFactory().createJsonParser(
        "[7,\"event:myevent1\","
          + "\"hello\","
          + "[\"NwtXQ8rdfPsy-ewS\",\"dYqgDl0FthI6_hjb\"]]"));
       
    if( !(msg instanceof WampPublishMessage) )
      fail("Wrong message type");
    assertEquals(WampMessage.PUBLISH, msg.getMessageType());
   
    WampPublishMessage pMsg = (WampPublishMessage)msg;
    assertEquals("event:myevent1", pMsg.getTopicId());
    assertEquals("hello", pMsg.getEvent());
   
View Full Code Here

Examples of com.github.ghetolay.jwamp.message.WampMessage

        WampMessageSerializer.serialize(msg, serializer.getObjectMapper()));
  }
 
  @Test
  public void deserialize5() throws JsonParseException, SerializationException, IOException{
    WampMessage msg = WampMessageDeserializer.deserialize(serializer.getObjectMapper().getJsonFactory().createJsonParser(
        "[7,\"event:myevent1\","
          + "\"hello\","
          + "[],"
          + "[\"NwtXQ8rdfPsy-ewS\"]]"));
       
    if( !(msg instanceof WampPublishMessage) )
      fail("Wrong message type");
    assertEquals(WampMessage.PUBLISH, msg.getMessageType());
   
    WampPublishMessage pMsg = (WampPublishMessage)msg;
    assertEquals("event:myevent1", pMsg.getTopicId());
    assertEquals("hello", pMsg.getEvent());
   
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.