Examples of IWebSocketConnection


Examples of org.apache.wicket.protocol.ws.api.IWebSocketConnection

    public void run()
    {
      Application application = Application.get(applicationName);
      IWebSocketSettings webSocketSettings = IWebSocketSettings.Holder.get(application);
      IWebSocketConnectionRegistry webSocketConnectionRegistry = webSocketSettings.getConnectionRegistry();
      IWebSocketConnection connection = webSocketConnectionRegistry.getConnection(application, sessionId, key);

      int dataIndex = 0;

      while (dataIndex < data.length)
      {
        try
        {
          Record record = data[dataIndex++];
          String json = String.format(JSON_SKELETON, record.year, record.field, record.value);

          if (connection == null || !connection.isOpen())
          {
            // stop if the web socket connection is closed
            return;
          }
          connection.sendMessage(json);

          // sleep for a while to simulate work
          TimeUnit.SECONDS.sleep(1);
        }
        catch (Exception x)
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.IWebSocketConnection

  {
    Args.notNull(application, "application");
    Args.notNull(sessionId, "sessionId");
    Args.notNull(key, "key");

    IWebSocketConnection connection = null;
    ConcurrentMap<String, ConcurrentMap<IKey, IWebSocketConnection>> connectionsBySession = application.getMetaData(KEY);
    if (connectionsBySession != null)
    {
      ConcurrentMap<IKey, IWebSocketConnection> connectionsByPage = connectionsBySession.get(sessionId);
      if (connectionsByPage != null)
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.IWebSocketConnection

    public void run()
    {
      Application application = Application.get(applicationName);
      WebSocketSettings webSocketSettings = WebSocketSettings.Holder.get(application);
      IWebSocketConnectionRegistry webSocketConnectionRegistry = webSocketSettings.getConnectionRegistry();
      IWebSocketConnection connection = webSocketConnectionRegistry.getConnection(application, sessionId, key);

      int dataIndex = 0;

      while (dataIndex < data.length)
      {
        try
        {
          Record record = data[dataIndex++];
          String json = String.format(JSON_SKELETON, record.year, record.field, record.value);

          if (connection == null || !connection.isOpen())
          {
            // stop if the web socket connection is closed
            return;
          }
          connection.sendMessage(json);

          // sleep for a while to simulate work
          TimeUnit.SECONDS.sleep(1);
        }
        catch (Exception x)
View Full Code Here

Examples of org.apache.wicket.protocol.ws.api.IWebSocketConnection

  {
    Args.notNull(application, "application");
    Args.notNull(sessionId, "sessionId");
    Args.notNull(key, "key");

    IWebSocketConnection connection = null;
    ConcurrentMap<String, ConcurrentMap<IKey, IWebSocketConnection>> connectionsBySession = application.getMetaData(KEY);
    if (connectionsBySession != null)
    {
      ConcurrentMap<IKey, IWebSocketConnection> connectionsByPage = connectionsBySession.get(sessionId);
      if (connectionsByPage != null)
View Full Code Here

Examples of org.xlightweb.IWebSocketConnection

       
        HttpClient httpClient = new HttpClient();

        httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/WebSocketsExample"));
       
        IWebSocketConnection wsCon = httpClient.openWebSocketConnection("ws://localhost:" + server.getLocalPort() + "/WebSocketsExample", "mySubprotocol");
       
        wsCon.writeMessage(new TextMessage("GetDate"));
        TextMessage msg = wsCon.readTextMessage();
       
       
       
        httpClient.close();
       
View Full Code Here

Examples of org.xlightweb.IWebSocketConnection

           
            public void onDisconnect(IWebSocketConnection con) throws IOException { }
           
            public void onConnect(IWebSocketConnection con) throws IOException, UnsupportedProtocolException {  }
        };
        IWebSocketConnection webSocketConnection = httpClient.openWebSocketConnection("ws://localhost:" + port, "com.example.echo", handler);
       
        webSocketConnection.writeMessage(new TextMessage("0123456789"));

       
       
        ////////////////////////////////////////////
        // without handler 
        IWebSocketConnection webSocketConnection2 = httpClient.openWebSocketConnection("ws://localhost:" + port, "com.example.echo");
   
        webSocketConnection2.writeMessage(new TextMessage("0123456789"));
        TextMessage msg = webSocketConnection2.readTextMessage();
        Assert.assertEquals("0123456789", msg.toString());

        webSocketConnection2.writeMessage(new TextMessage("0123456789"));
        msg = webSocketConnection2.readTextMessage();
        Assert.assertEquals("0123456789", msg.toString());

        webSocketConnection.close();
        webSocketConnection2.close();
    }
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.