Encoding
package neffos
var (
DefaultMarshaler = json.Marshal
DefaultUnmarshaler = json.Unmarshal
)
type (
MessageObjectMarshaler interface {
Marshal() ([]byte, error)
}
MessageObjectUnmarshaler interface {
Unmarshal(body []byte) error
}
)
type Message struct {
// [...]
}
func (m *Message) Unmarshal(outPtr interface{}) error {
if unmarshaler, ok := outPtr.(MessageObjectUnmarshaler); ok {
return unmarshaler.Unmarshal(m.Body)
}
return DefaultUnmarshaler(m.Body, outPtr)
}Create our userMessage structure
Define the server and client events
Create and run our Server
Create our (Go) Client side
Create our (Javascript browserify) Client side
Third-party Requirements
How to run
Last updated