fix 推送sid

This commit is contained in:
luying
2021-01-22 11:01:26 +08:00
parent 65320fb9e0
commit f8d7967e34
3 changed files with 4 additions and 8 deletions

View File

@@ -35,9 +35,8 @@ export class ChatRemote {
* @param {boolean} flag 是否创建新channel
*
*/
public async addWorldChannel(roleId: string, serverId: number, flag: boolean = true) {
public async addWorldChannel(roleId: string, serverId: number, sid: string, flag: boolean = true) {
const name = `world${serverId}`;
const sid = this.app.getServerId();
let channel = this.channelService.getChannel(name, flag);
let param = {
roleId
@@ -80,9 +79,8 @@ export class ChatRemote {
* @param {String} serverId 区id
*
*/
public async kickWorldChannel(roleId: string, serverId: number) {
public async kickWorldChannel(roleId: string, sid: string, serverId: number) {
const name = `world${serverId}`;
const sid = this.app.getServerId();
let channel = this.channelService.getChannel(name, false);
// leave channel

View File

@@ -79,7 +79,7 @@ export class EntryHandler {
// console.log(JSON.stringify(self.app.rpc.battle))
// await self.app.rpc.battle.battleRemote.add.route(session)(role.roleId, self.app.get('serverId'), role.serverId, true);
await self.app.rpc.chat.chatRemote.addWorldChannel.route(session)(role.roleId, serverId);
await self.app.rpc.chat.chatRemote.addWorldChannel.route(session)(role.roleId, serverId, self.app.get('serverId'));
let heros = await HeroModel.findByRole(role.roleId);
let equips = await EquipModel.findbyRole(role.roleId);
let items = await ItemModel.findbyRole(role.roleId);
@@ -119,7 +119,7 @@ export class EntryHandler {
let channel = channelService.getChannel(roleId, true);
channel.leave(roleId, sid);
// this.app.rpc.battle.battleRemote.kick.route(session)(roleId, this.app.get('serverId'), serverId);
this.app.rpc.chat.chatRemote.kickWorldChannel.route(session, true)(roleId, serverId);
this.app.rpc.chat.chatRemote.kickWorldChannel.route(session, true)(roleId, sid, serverId);
}

View File

@@ -53,8 +53,6 @@ module.exports = {
],
'chat': [
{'id': 'chat-server-1', 'host': '127.0.0.1', 'port': 6050},
{'id': 'chat-server-2', 'host': '127.0.0.1', 'port': 6051},
{'id': 'chat-server-3', 'host': '127.0.0.1', 'port': 6052}
],
'role': [
{'id': 'role-server-1', 'host': '127.0.0.1', 'port': 6053}