Exemplo n.º 1
0
// Say hello
func (this *BinProtocol) WriteHello(writer io.Writer, hello *dynmap.DynMap) error {
	err := binary.Write(writer, binary.BigEndian, BINCONST.ParamEncoding["json"])
	if err != nil {
		return err
	}

	hello.PutIfAbsent("v", StrestVersion)
	hello.PutIfAbsent("useragent", "golang")
	b, err := hello.MarshalJSON()
	if err != nil {
		return err
	}
	_, err = WriteString(writer, string(b))
	return err
}