diff --git a/ws/client.go b/ws/client.go index 07c4c04..82c1acc 100644 --- a/ws/client.go +++ b/ws/client.go @@ -80,9 +80,17 @@ func (c *Client) asyncReader(s *Server) { func (c *Client) asyncWriter(s *Server){ - for buffer := range c.sendc { + for payload := range c.sendc { + + fmt.Printf("Writing '%s'\n", payload) + + // Build Frame + f := BuildFromPayload(payload) + + // Send over socket + c.sock.Write( f.Bytes() ) + - fmt.Printf("Writing '%s'\n", buffer) } diff --git a/ws/frame.go b/ws/frame.go index 935e331..f1f8344 100644 --- a/ws/frame.go +++ b/ws/frame.go @@ -101,4 +101,21 @@ func (f *Frame) ReadPayload(b *bytes.Buffer, s net.Conn) error{ return nil +} + + + + + +// BuildFromPayload builds a frame from only a payload +// (as []byte) +func BuildFromPayload(payload []byte) *Frame { + return nil +} + + +// Bytes returns the BYTE representation of the frame +// for sending over the network (into socket) +func (f *Frame) Bytes() []byte { + return nil } \ No newline at end of file