当前位置: 首页>>代码示例>>Java>>正文


Java SocketIOTransport类代码示例

本文整理汇总了Java中com.koushikdutta.async.http.socketio.transport.SocketIOTransport的典型用法代码示例。如果您正苦于以下问题:Java SocketIOTransport类的具体用法?Java SocketIOTransport怎么用?Java SocketIOTransport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SocketIOTransport类属于com.koushikdutta.async.http.socketio.transport包,在下文中一共展示了SocketIOTransport类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupHeartbeat

import com.koushikdutta.async.http.socketio.transport.SocketIOTransport; //导入依赖的package包/类
void setupHeartbeat() {
    Runnable heartbeatRunner = new Runnable() {
        @Override
        public void run() {
            final SocketIOTransport ts = transport;

            if (heartbeat <= 0 || ts == null || !ts.isConnected())
                return;

            ts.send("2:::");
            ts.getServer().postDelayed(this, heartbeat);
        }
    };

    heartbeatRunner.run();
}
 
开发者ID:jacklongway,项目名称:LiteSDK,代码行数:17,代码来源:SocketIOConnection.java

示例2: setupHeartbeat

import com.koushikdutta.async.http.socketio.transport.SocketIOTransport; //导入依赖的package包/类
void setupHeartbeat() {
    final SocketIOTransport ts = transport;
    Runnable heartbeatRunner = new Runnable() {
        @Override
        public void run() {
            if (heartbeat <= 0 || ts != transport || ts == null || !ts.isConnected())
                return;

            transport.send("2:::");

            if (transport != null)
                transport.getServer().postDelayed(this, heartbeat);
        }
    };
    heartbeatRunner.run();
}
 
开发者ID:omerjerk,项目名称:RemoteDroid,代码行数:17,代码来源:SocketIOConnection.java

示例3: acknowledge

import com.koushikdutta.async.http.socketio.transport.SocketIOTransport; //导入依赖的package包/类
private Acknowledge acknowledge(final String _messageId, final String endpoint) {
    if (TextUtils.isEmpty(_messageId))
        return null;

    final String messageId = _messageId.replaceAll("\\+$", "");

    return new Acknowledge() {
        @Override
        public void acknowledge(JSONArray arguments) {
            String data = "";
            if (arguments != null)
                data += "+" + arguments.toString();
            SocketIOTransport transport = SocketIOConnection.this.transport;
            if (transport == null) {
                final Exception e = new SocketIOException("not connected to server");
                select(endpoint, new SelectCallback() {
                    @Override
                    public void onSelect(SocketIOClient client) {
                        ExceptionCallback callback = client.exceptionCallback;
                        if (callback != null)
                            callback.onException(e);
                    }
                });
                return;
            }
            transport.send(String.format(Locale.ENGLISH, "6:::%s%s", messageId, data));
        }
    };
}
 
开发者ID:jacklongway,项目名称:LiteSDK,代码行数:30,代码来源:SocketIOConnection.java

示例4: disconnect

import com.koushikdutta.async.http.socketio.transport.SocketIOTransport; //导入依赖的package包/类
public void disconnect(SocketIOClient client) {
    clients.remove(client);

    // see if we can leave this endpoint completely
    boolean needsEndpointDisconnect = true;
    for (SocketIOClient other: clients) {
        // if this is the default endpoint (which disconnects everything),
        // or another client is using this endpoint,
        // we can't disconnect
        if (TextUtils.equals(other.endpoint, client.endpoint) || TextUtils.isEmpty(client.endpoint)) {
            needsEndpointDisconnect = false;
            break;
        }
    }

    final SocketIOTransport ts = transport;

    if (needsEndpointDisconnect && ts != null)
        ts.send(String.format(Locale.ENGLISH, "0::%s", client.endpoint));

    // and see if we can disconnect the socket completely
    if (clients.size() > 0 || ts == null)
        return;

    ts.setStringCallback(null);
    ts.setClosedCallback(null);
    ts.disconnect();
    transport = null;
}
 
开发者ID:pogointel,项目名称:openmap-client-android,代码行数:30,代码来源:SocketIOConnection.java

示例5: acknowledge

import com.koushikdutta.async.http.socketio.transport.SocketIOTransport; //导入依赖的package包/类
private Acknowledge acknowledge(final String _messageId, final String endpoint) {
    if (TextUtils.isEmpty(_messageId))
        return null;

    final String messageId = _messageId.replaceAll("\\+$", "");

    return new Acknowledge() {
        @Override
        public void acknowledge(JSONArray arguments) {
            String data = "";
            if (arguments != null)
                data += "+" + arguments.toString();
            SocketIOTransport transport = SocketIOConnection.this.transport;
            if (transport == null) {
                final Exception e = new SocketIOException("not connected to server");
                select(endpoint, new SelectCallback() {
                    @Override
                    public void onSelect(SocketIOClient client) {
                        ExceptionCallback callback = client.exceptionCallback;
                        if (callback != null)
                            callback.onException(e);
                    }
                });
                return;
            }
            transport.send(String.format("6:::%s%s", messageId, data));
        }
    };
}
 
开发者ID:omerjerk,项目名称:RemoteDroid,代码行数:30,代码来源:SocketIOConnection.java

示例6: getTransport

import com.koushikdutta.async.http.socketio.transport.SocketIOTransport; //导入依赖的package包/类
public SocketIOTransport getTransport() {
    return connection.transport;
}
 
开发者ID:jacklongway,项目名称:LiteSDK,代码行数:4,代码来源:SocketIOClient.java


注:本文中的com.koushikdutta.async.http.socketio.transport.SocketIOTransport类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。