Search in sources :

Example 1 with LightlyWebSocketAdapter

use of com.eros.framework.extend.adapter.LightlyWebSocketAdapter in project WeexErosFramework by bmfe.

the class WebSocketModule method webSocket.

@JSMethod
public void webSocket(String url, String protocol) {
    webSocketAdapter = mWXSDKInstance.getWXWebSocketAdapter();
    Log.e("webSocket", "this>>>>>" + this + "id>>>>>" + mWXSDKInstance.getInstanceId());
    if (!reportErrorIfNoAdapter()) {
        LightlyWebSocketAdapter bmWebSocketAdapter = (LightlyWebSocketAdapter) webSocketAdapter;
        bmWebSocketAdapter.connect(url, protocol, eventListener, mWXSDKInstance.getInstanceId());
    }
}
Also used : LightlyWebSocketAdapter(com.eros.framework.extend.adapter.LightlyWebSocketAdapter) JSMethod(com.taobao.weex.annotation.JSMethod)

Example 2 with LightlyWebSocketAdapter

use of com.eros.framework.extend.adapter.LightlyWebSocketAdapter in project WeexErosFramework by bmfe.

the class WebSocketModule method close.

@JSMethod
public void close(String code, String reason) {
    if (!reportErrorIfNoAdapter()) {
        Log.e(TAG, "close>>>>>>" + reason);
        int codeNumber = WebSocketCloseCodes.CLOSE_NORMAL.getCode();
        if (code != null) {
            try {
                codeNumber = Integer.parseInt(code);
            } catch (NumberFormatException e) {
            // ignore
            }
        }
        LightlyWebSocketAdapter bmWebSocketAdapter = (LightlyWebSocketAdapter) webSocketAdapter;
        bmWebSocketAdapter.close(codeNumber, reason, mWXSDKInstance.getInstanceId());
    }
}
Also used : LightlyWebSocketAdapter(com.eros.framework.extend.adapter.LightlyWebSocketAdapter) JSMethod(com.taobao.weex.annotation.JSMethod)

Example 3 with LightlyWebSocketAdapter

use of com.eros.framework.extend.adapter.LightlyWebSocketAdapter in project WeexErosFramework by bmfe.

the class WebSocketModule method send.

@JSMethod
public void send(String data) {
    Log.e(TAG, "send>>>>>>" + data + this);
    if (!reportErrorIfNoAdapter()) {
        LightlyWebSocketAdapter bmWebSocketAdapter = (LightlyWebSocketAdapter) webSocketAdapter;
        bmWebSocketAdapter.send(data, mWXSDKInstance.getInstanceId());
    }
}
Also used : LightlyWebSocketAdapter(com.eros.framework.extend.adapter.LightlyWebSocketAdapter) JSMethod(com.taobao.weex.annotation.JSMethod)

Aggregations

LightlyWebSocketAdapter (com.eros.framework.extend.adapter.LightlyWebSocketAdapter)3 JSMethod (com.taobao.weex.annotation.JSMethod)3