Hello,
I need help to improve the reliability of a proxy and numerous servers in Golang, currently in use by a certain number of users. I receive json stream by TCP and websocket. The only way to do it properly is to used json decode. (notably because websocket payload system can split in multiple payloads. Whatever.) Decode function is defined as such : func (dec *Decoder <https://golang.org/pkg/encoding/json/#Decoder>) Decode(v interface{}) error <https://golang.org/pkg/builtin/#error> The error specified what is problem encoutered by Decode, *but not the original message*. For example, the error returned may show : "*invalid character 'G' looking for beginning of value*". But you can't see the original message. Untill now, I found only 1 way to do it. It's to read the buffer before reading it. Example : *var buff []byte* *bb, _ = ioutil.ReadAll(reader.Buffered())* *fmt.Println("Before :", string(bb))* *var tmp interface{}* *err := reader.Decode(&tmp) * 2 problems with this : 1- I'm not sure the buffer is always complete at the time I call the ReadAll 2- It can be time-consuming Am I missing something to handle this better ? Thanks a lot for your answers. Thomas -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.