added 'asyncWriter()' behavior + frame interface TODO
This commit is contained in:
parent
c3121df33f
commit
2d220fc34b
12
ws/client.go
12
ws/client.go
|
@ -80,9 +80,17 @@ func (c *Client) asyncReader(s *Server) {
|
||||||
func (c *Client) asyncWriter(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)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
17
ws/frame.go
17
ws/frame.go
|
@ -102,3 +102,20 @@ func (f *Frame) ReadPayload(b *bytes.Buffer, s net.Conn) error{
|
||||||
return nil
|
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
|
||||||
|
}
|
Loading…
Reference in New Issue