WritePing writes a ping message to the writer
(w io.Writer, nonce uint64)
| 20 | |
| 21 | // WritePing writes a ping message to the writer |
| 22 | func WritePing(w io.Writer, nonce uint64) error { |
| 23 | if err := writeByte(w, OpPing); err != nil { |
| 24 | return fmt.Errorf("failed to write ping opcode: %w", err) |
| 25 | } |
| 26 | if err := writeUint64(w, nonce); err != nil { |
| 27 | return fmt.Errorf("failed to write ping nonce: %w", err) |
| 28 | } |
| 29 | return nil |
| 30 | } |
| 31 | |
| 32 | // WritePong writes a pong message to the writer |
| 33 | func WritePong(w io.Writer, nonce uint64) error { |