-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMessage.cs
More file actions
46 lines (40 loc) · 935 Bytes
/
Message.cs
File metadata and controls
46 lines (40 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Codeplex.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization.Json;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
namespace WebSocketServer2
{
public class MessageParser
{
static public Message Parse(string msg)
{
var json = DynamicJson.Parse(msg);
if (json.name == "joinRoom")
{
return new JoinRoom(json.name, json.socketId);
}
return null;
}
}
public class Message
{
public Message(string name)
{
Name = name;
}
public string Name { get; set; }
}
public class JoinRoom : Message
{
public JoinRoom(string name, string socketId)
: base(name)
{
SocketId = socketId;
}
public string SocketId { get; set; }
}
}