Reader attempts to read a message from the connection. The maximum time spent waiting is bounded by the context.
(ctx context.Context)
| 335 | // Reader attempts to read a message from the connection. |
| 336 | // The maximum time spent waiting is bounded by the context. |
| 337 | func (c *Conn) Reader(ctx context.Context) (MessageType, io.Reader, error) { |
| 338 | typ, p, err := c.Read(ctx) |
| 339 | if err != nil { |
| 340 | return 0, nil, err |
| 341 | } |
| 342 | return typ, bytes.NewReader(p), nil |
| 343 | } |
| 344 | |
| 345 | // Writer returns a writer to write a WebSocket data message to the connection. |
| 346 | // It buffers the entire message in memory and then sends it when the writer |