| | |
| | | |
| | | private fun initSocket() { |
| | | Handler(Looper.getMainLooper()).post { |
| | | toast("websocket初始化") |
| | | // toast("websocket初始化") |
| | | } |
| | | NettyClient.getInstance().init(this, Api.SOCKET_SERVER, Api.SOCKET_PORT, true) |
| | | NettyClient.getInstance() |
| | |
| | | val json = JSONObject(message) |
| | | val method = json.optString("method") |
| | | Handler(Looper.getMainLooper()).post { |
| | | toast("收到websocket=$method") |
| | | // toast("收到websocket=$method") |
| | | } |
| | | val data = json.optString("data") |
| | | val code = json.optInt("code", -1) |
| | |
| | | bean.data = dataBean |
| | | NettyClient.getInstance() |
| | | .sendMessage(Gson().toJson(bean)) |
| | | // Handler(Looper.getMainLooper()).post { |
| | | Handler(Looper.getMainLooper()).post { |
| | | // toast("发送location --> $dataBean") |
| | | // } |
| | | } |
| | | sysErr(dataBean.toString()) |
| | | } |
| | | } |