added 'asyncWriter()' behavior + frame interface TODO

This commit is contained in:
xdrm-brackets 2018-04-28 17:56:37 +02:00
parent c3121df33f
commit 2d220fc34b
2 changed files with 27 additions and 2 deletions

View File

@ -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)
}

View File

@ -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
}