qewqeqw
This commit is contained in:
parent
133e6f6534
commit
e1bde99244
|
@ -12,14 +12,10 @@ namespace GameServer
|
|||
internal class Program
|
||||
{
|
||||
private static ConcurrentDictionary<string, TcpClient> clients = new ConcurrentDictionary<string, TcpClient>();
|
||||
public static SubscriberSocket ToClientSubscriber;
|
||||
public static PublisherSocket ToClientPublisher;
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Task.Run(RunServer);
|
||||
ToClientPublisher = new PublisherSocket();
|
||||
ToClientPublisher.Bind("tcp://*:8888");
|
||||
}
|
||||
|
||||
static async Task RunServer()
|
||||
|
@ -75,7 +71,6 @@ namespace GameServer
|
|||
Console.WriteLine($"创建房间 {commands[1]}");
|
||||
var room = Room.Create(commands[1], user.userId);
|
||||
response = Encoding.UTF8.GetBytes(string.Format("createroom {0},{1},{2}", room.roomId, room.roomname, room.creater));
|
||||
ToClientSubscriber.Subscribe(room.roomId.ToString());
|
||||
Console.WriteLine("订阅:" + room.roomId.ToString());
|
||||
await stream.WriteAsync(response, 0, response.Length);
|
||||
break;
|
||||
|
@ -122,7 +117,6 @@ namespace GameServer
|
|||
if (!string.IsNullOrWhiteSpace(close))
|
||||
{
|
||||
response = Encoding.UTF8.GetBytes(string.Format("closeroom {0}", close));
|
||||
ToClientSubscriber.Unsubscribe(close);
|
||||
Console.WriteLine("退订:" + close);
|
||||
await stream.WriteAsync(response, 0, response.Length);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue