Writer returns a writer to write a WebSocket data message to the connection. It buffers the entire message in memory and then sends it when the writer is closed.
(ctx context.Context, typ MessageType)
| 346 | // It buffers the entire message in memory and then sends it when the writer |
| 347 | // is closed. |
| 348 | func (c *Conn) Writer(ctx context.Context, typ MessageType) (io.WriteCloser, error) { |
| 349 | return &writer{ |
| 350 | c: c, |
| 351 | ctx: ctx, |
| 352 | typ: typ, |
| 353 | b: bpool.Get(), |
| 354 | }, nil |
| 355 | } |
| 356 | |
| 357 | type writer struct { |
| 358 | closed bool |