Package io.socket

Examples of io.socket.SocketIO


    }

    final String uri = (String) exchangeSpecification.getExchangeSpecificParametersItem(CoinsetterExchange.WEBSOCKET_URI_KEY);

    try {
      socket = new SocketIO(uri);
    } catch (MalformedURLException e) {
      throw new IllegalArgumentException(e);
    }
  }
View Full Code Here


    }
   
    @Override
    public void run() {
        try {
      socket = new SocketIO("http://localhost:3000", callback);
    } catch (MalformedURLException e) {
      e.printStackTrace();
    }
    }
View Full Code Here

      e.printStackTrace();
    }
  }

  public BasicExample() throws Exception {
    socket = new SocketIO();
    socket.connect("http://127.0.0.1:3001/", this);

    // Sends a string to the server.
    socket.send("Hello Server");
View Full Code Here

      e.printStackTrace();
    }
  }

  public AcknowledgeExample() throws Exception {
    socket = new SocketIO();
    socket.connect("http://127.0.0.1:3001/", this);

    // Sends a string to the server.
    socket.send(new IOAcknowledge() {
      @Override
View Full Code Here

      e.printStackTrace();
    }
  }

  public BasicExample2() throws Exception {
    SocketIO socket = new SocketIO("http://127.0.0.1:3001/");
    socket.connect(new IOCallback() {
      @Override
      public void onMessage(JSONObject json, IOAcknowledge ack) {
        try {
          System.out.println("Server said:" + json.toString(2));
        } catch (JSONException e) {
          e.printStackTrace();
        }
      }

      @Override
      public void onMessage(String data, IOAcknowledge ack) {
        System.out.println("Server said: " + data);
      }

      @Override
      public void onError(SocketIOException socketIOException) {
        System.out.println("an Error occured");
        socketIOException.printStackTrace();
      }

      @Override
      public void onDisconnect() {
        System.out.println("Connection terminated.");
      }

      @Override
      public void onConnect() {
        System.out.println("Connection established");
      }

      @Override
      public void on(String event, IOAcknowledge ack, Object... args) {
        System.out.println("Server triggered event '" + event + "'");
      }
    });
   
    // This line is cached until the connection is establisched.
    socket.send("Hello Server!");
  }
View Full Code Here

  }
 
  private void connectToServer() {
   
    try {
      socket = new SocketIO("http://localhost:17790");
//      socket = new SocketIO("http://backyardpirates.nodester.com:80");

      socket.connect(new IOCallback() {
       
       
View Full Code Here

 
  public Koneksi(String address)
  {
    try
    {
      socket = new SocketIO(address);
          socket.connect(new IOCallback() {
              @Override
              public void onMessage(JSONObject json, IOAcknowledge ack) {
                  //..algorithm
              }
View Full Code Here

TOP

Related Classes of io.socket.SocketIO

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.