[Update]Netty支持多channel通信和业务身份绑定
This commit is contained in:
@@ -45,7 +45,7 @@ public class NettyClientActivity extends AppCompatActivity implements View.OnCli
|
||||
setContentView(R.layout.activity_netty_client);
|
||||
findViews();
|
||||
initView();
|
||||
NSDNettyManager.getInstance().searchAndConnectServer(this, this);
|
||||
NSDNettyManager.getInstance().searchAndConnectServer(this, "0", this);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
@@ -107,21 +107,21 @@ public class NettyClientActivity extends AppCompatActivity implements View.OnCli
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageResponseClient(MogoProtocolMsg msg, int index) {
|
||||
public void onMessageResponseClient(MogoProtocolMsg msg, String sign) {
|
||||
String result = msg.toString();
|
||||
Log.e(TAG, "onMessageResponse:" + result);
|
||||
logRece(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClientStatusConnectChanged(final int statusCode, final int index) {
|
||||
public void onClientStatusConnectChanged(final int statusCode, final String sign) {
|
||||
runOnUiThread(() -> {
|
||||
if (statusCode == ConnectState.STATUS_CONNECT_SUCCESS) {
|
||||
Log.e(TAG, "STATUS_CONNECT_SUCCESS:");
|
||||
mConnect.setText("DisConnect:" + index);
|
||||
mConnect.setText("DisConnect:" + sign);
|
||||
} else {
|
||||
Log.e(TAG, "onServiceStatusConnectChanged:" + statusCode);
|
||||
mConnect.setText("Connect:" + index);
|
||||
mConnect.setText("Connect:" + sign);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -152,8 +152,8 @@ public class NettyServerActivity extends AppCompatActivity implements View.OnCli
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageResponseServer(MogoProtocolMsg msg, String channelId) {
|
||||
Log.e(TAG,"onMessageResponseServer:channelId:" + channelId);
|
||||
public void onMessageResponseServer(MogoProtocolMsg msg, Channel channel) {
|
||||
Log.e(TAG,"onMessageResponseServer:channelId:" + channel.id().asShortText());
|
||||
|
||||
String result = msg.toString();
|
||||
Log.e(TAG, "onMessageResponse:" + result);
|
||||
|
||||
Reference in New Issue
Block a user