Más contenido relacionado
Go でリアルタイムゲームサーバーを作っている話
- 11. 4/14/2017 Go
http://127.0.0.1:3999/main.slide#20 11/21
Go
type Ping struct {
Message string `json:"message" msgpack:"message"`
}
func (t *Ping) Coerce() error {
return nil
}
func (t *Ping) Bytes(serializer typhenapi.Serializer) ([]byte, error) {
if err := t.Coerce(); err != nil {
return nil, err
}
data, err := serializer.Serialize(t)
if err != nil {
return nil, err
}
return data, nil
}
- 12. 4/14/2017 Go
http://127.0.0.1:3999/main.slide#20 12/21
C#
namespace TyphenApi.Type.Submarine.Battle
{
[MessagePack.MessagePackObject]
[Newtonsoft.Json.JsonObject(Newtonsoft.Json.MemberSerialization.OptIn)]
public partial class Ping : TyphenApi.TypeBase<Ping>, TyphenApi.IRealTimeMessage
{
[TyphenApi.QueryStringProperty("message", false)]
[MessagePack.Key("message")]
[Newtonsoft.Json.JsonProperty("message")]
[Newtonsoft.Json.JsonRequired]
public string Message { get; set; }
}
}