davidknaack/OMGFirLumber — pull request #2 by jamesharr (2014-01-18 06:48:44+00:00)
Title: Use JSON for WebSocket message framing

I managed to resist the urge to go nuts (rim shot) on your Go code, but I did modify it to use JSON for message framing. EMBRACE THE ALL MIGHTY `interface{}`.

Also, this doesn't do what I suspect you thought it did.

```go
broadcast: make(chan []byte, maxMessageSize)
```

It creates "slice of byte" channel that can have up to `maxMessageSize` messages buffered in it. No inherent limit on the `[]byte`. I opted to remove the buffering since your readPump() shouldn't really block on anything. If you need it to buffer for whatever reason (serial library is delay sensitive), then you could buffer it by 1, but I suspect that won't be an issue.