{"$schema":"https://doc-kit.nodejs.org/schemas/api-doc/1.0.0.json","id":"dtls","path":"/dtls","type":"module","module":"dtls","title":"DTLS","introducedIn":"v26.9.0","sourceLink":{"path":"lib/dtls.js","url":"https://github.com/nodejs/node/blob/HEAD/lib/dtls.js"},"stability":{"index":"1","description":"Experimental"},"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"The `node:dtls` module provides an implementation of the Datagram Transport\nLayer Security (DTLS) protocol over UDP. DTLS provides TLS-equivalent\nsecurity guarantees for datagram-based communication, including\nconfidentiality, integrity, and authentication.\n\nTo use this module, it must be enabled at build time with the\n`--experimental-dtls` configure flag and at runtime with the\n`--experimental-dtls` CLI flag.\n\n```bash\nnode --experimental-dtls app.mjs\n```\n\n```mjs\nimport { listen, connect } from 'node:dtls';\n```\n\n```cjs\nconst { listen, connect } = require('node:dtls');\n```","summary":"The `node:dtls` module provides an implementation of the Datagram Transport Layer Security (DTLS) protocol over UDP. DTLS provides TLS-equivalent security guarantees for datagram-based communication, including confidentiality, integrity, and authentication.","examples":[{"language":"bash","displayName":null,"code":"node --experimental-dtls app.mjs"},{"language":"mjs","displayName":null,"code":"import { listen, connect } from 'node:dtls';"},{"language":"cjs","displayName":null,"code":"const { listen, connect } = require('node:dtls');"}],"children":[{"kind":"section","id":"permission-model","name":"Permission model","title":"Permission model","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"When using the [Permission Model](permissions.html#permission-model), the `--allow-net` flag must be passed to\nallow DTLS network operations. Without it, calling [`dtls.connect()`](#dtlsconnecthost-port-options) or\n[`dtls.listen()`](#dtlslistencallback-options) will throw an `ERR_ACCESS_DENIED` error.\n\n```console\nnode --permission --allow-fs-read=* --experimental-dtls index.mjs\nError: Access to this API has been restricted. Use --allow-net to manage permissions.\n  code: 'ERR_ACCESS_DENIED',\n  permission: 'Net',\n}\n```\n\nCreating a [`DTLSEndpoint`](#class-dtlsendpoint) instance without connecting or listening\nis permitted even without `--allow-net`, since no network I/O occurs until\n[`dtls.connect()`](#dtlsconnecthost-port-options) or [`dtls.listen()`](#dtlslistencallback-options) is called.","summary":"When using the Permission Model, the `--allow-net` flag must be passed to allow DTLS network operations. Without it, calling `dtls.connect()` or `dtls.listen()` will throw an `ERR_ACCESS_DENIED` error.","examples":[{"language":"console","displayName":null,"code":"node --permission --allow-fs-read=* --experimental-dtls index.mjs\nError: Access to this API has been restricted. Use --allow-net to manage permissions.\n  code: 'ERR_ACCESS_DENIED',\n  permission: 'Net',\n}"}],"children":[]},{"kind":"section","id":"dtls-vs-tls","name":"DTLS vs TLS","title":"DTLS vs TLS","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"DTLS is designed for UDP transport and differs from TLS in several key ways:\n\n* No stream guarantees: Messages may arrive out of order or be lost.\n  DTLS preserves datagram semantics.\n* One socket, many peers: A single UDP socket can serve multiple DTLS\n  sessions. The `DTLSEndpoint` manages this multiplexing.\n* Cookie exchange: DTLS servers use a stateless cookie mechanism\n  (HelloVerifyRequest) to prevent denial-of-service amplification attacks.\n* Retransmission: DTLS handles handshake retransmission internally since\n  UDP does not guarantee delivery.","summary":"DTLS is designed for UDP transport and differs from TLS in several key ways:","examples":[],"children":[]},{"kind":"method","id":"dtlslistencallback-options","name":"listen","title":"`dtls.listen(callback, options)`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"callback","type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"description":"Called for each new DTLS session accepted by the\nserver.","default":null,"optional":false,"rest":false,"properties":[{"name":"session","type":{"text":"DTLSSession","links":[]},"description":"The new session.","default":null,"optional":false,"rest":false,"properties":[]}]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":false,"rest":false,"properties":[{"name":"cert","type":{"text":"string | Buffer","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Buffer","href":"buffer.html#class-buffer","start":9,"end":15}]},"description":"Server certificate in PEM format. **Required.**","default":null,"optional":false,"rest":false,"properties":[]},{"name":"key","type":{"text":"string | Buffer","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Buffer","href":"buffer.html#class-buffer","start":9,"end":15}]},"description":"Server private key in PEM format. **Required.**","default":null,"optional":false,"rest":false,"properties":[]},{"name":"port","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Port to bind to. **Required.**","default":null,"optional":false,"rest":false,"properties":[]},{"name":"host","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Address to bind to.","default":"'0.0.0.0'","optional":true,"rest":false,"properties":[]},{"name":"ca","type":{"text":"string | Buffer | string[] | Buffer[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Buffer","href":"buffer.html#class-buffer","start":9,"end":15},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":18,"end":24},{"name":"Buffer","href":"buffer.html#class-buffer","start":29,"end":35}]},"description":"CA certificates in PEM format.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"ciphers","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"OpenSSL cipher list string.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"alpn","type":{"text":"string[] | Buffer","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Buffer","href":"buffer.html#class-buffer","start":11,"end":17}]},"description":"ALPN protocol names.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"srtp","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Colon-separated SRTP protection profile names\n(e.g., `'SRTP_AES128_CM_SHA1_80:SRTP_AEAD_AES_128_GCM'`).","default":null,"optional":false,"rest":false,"properties":[]},{"name":"requestCert","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"Request client certificate.","default":"false","optional":true,"rest":false,"properties":[]},{"name":"mtu","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum transmission unit for DTLS records.","default":"1200","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"DTLSEndpoint","links":[]},"description":""}},"description":"Creates a DTLS server bound to the specified address and port. The server\nuses automatic HMAC-based cookie exchange for DoS protection.\n\n```mjs\nimport { listen } from 'node:dtls';\nimport { readFileSync } from 'node:fs';\n\nconst endpoint = listen((session) => {\n  session.onmessage = (data) => {\n    console.log('Received:', data.toString());\n    session.send('pong');\n  };\n\n  session.onhandshake = (protocol) => {\n    console.log('Handshake complete:', protocol);\n  };\n}, {\n  cert: readFileSync('server-cert.pem'),\n  key: readFileSync('server-key.pem'),\n  port: 4433,\n});\n\nconsole.log('DTLS server listening on', endpoint.address);\n```","summary":"Creates a DTLS server bound to the specified address and port. The server uses automatic HMAC-based cookie exchange for DoS protection.","examples":[{"language":"mjs","displayName":null,"code":"import { listen } from 'node:dtls';\nimport { readFileSync } from 'node:fs';\n\nconst endpoint = listen((session) => {\n  session.onmessage = (data) => {\n    console.log('Received:', data.toString());\n    session.send('pong');\n  };\n\n  session.onhandshake = (protocol) => {\n    console.log('Handshake complete:', protocol);\n  };\n}, {\n  cert: readFileSync('server-cert.pem'),\n  key: readFileSync('server-key.pem'),\n  port: 4433,\n});\n\nconsole.log('DTLS server listening on', endpoint.address);"}],"children":[]},{"kind":"method","id":"dtlsconnecthost-port-options","name":"connect","title":"`dtls.connect(host, port[, options])`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"host","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Remote host to connect to.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"port","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Remote port to connect to.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"options","type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"description":"","default":null,"optional":true,"rest":false,"properties":[{"name":"ca","type":{"text":"string | Buffer | string[] | Buffer[]","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Buffer","href":"buffer.html#class-buffer","start":9,"end":15},{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":18,"end":24},{"name":"Buffer","href":"buffer.html#class-buffer","start":29,"end":35}]},"description":"CA certificates in PEM format.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"cert","type":{"text":"string | Buffer","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Buffer","href":"buffer.html#class-buffer","start":9,"end":15}]},"description":"Client certificate in PEM format.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"key","type":{"text":"string | Buffer","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Buffer","href":"buffer.html#class-buffer","start":9,"end":15}]},"description":"Client private key in PEM format.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"rejectUnauthorized","type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"description":"When `true`, the server's certificate must\nboth chain to a trusted CA and match the expected identity (`servername`,\nor `host` when `servername` is not set); otherwise the handshake is\naborted and `session.opened` rejects. When `false`, the certificate is not\nverified.","default":"true","optional":true,"rest":false,"properties":[]},{"name":"servername","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Server name used for the SNI (Server Name\nIndication) extension and as the identity checked during certificate\nverification.","default":"the `host` argument. Set to `''` to disable SNI. SNI is never sent for IP address literals","optional":true,"rest":false,"properties":[]},{"name":"bindHost","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"Local bind address.","default":"'0.0.0.0'","optional":true,"rest":false,"properties":[]},{"name":"bindPort","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Local bind port.","default":"`0` (ephemeral)","optional":true,"rest":false,"properties":[]},{"name":"alpn","type":{"text":"string[] | Buffer","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Buffer","href":"buffer.html#class-buffer","start":11,"end":17}]},"description":"ALPN protocol names.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"srtp","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"SRTP protection profile names.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"mtu","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Maximum transmission unit.","default":"1200","optional":true,"rest":false,"properties":[]}]}],"returns":{"type":{"text":"DTLSSession","links":[]},"description":""}},"description":"Connects to a DTLS server. Returns a `DTLSSession` whose `opened` property\nis a `Promise` that resolves when the handshake completes.\n\n```mjs\nimport { connect } from 'node:dtls';\nimport { readFileSync } from 'node:fs';\n\nconst session = connect('localhost', 4433, {\n  ca: [readFileSync('ca-cert.pem')],\n});\n\nawait session.opened;\nsession.send('hello');\n\nsession.onmessage = (data) => {\n  console.log('Received:', data.toString());\n};\n```","summary":"Connects to a DTLS server. Returns a `DTLSSession` whose `opened` property is a `Promise` that resolves when the handshake completes.","examples":[{"language":"mjs","displayName":null,"code":"import { connect } from 'node:dtls';\nimport { readFileSync } from 'node:fs';\n\nconst session = connect('localhost', 4433, {\n  ca: [readFileSync('ca-cert.pem')],\n});\n\nawait session.opened;\nsession.send('hello');\n\nsession.onmessage = (data) => {\n  console.log('Received:', data.toString());\n};"}],"children":[]},{"kind":"class","id":"class-dtlsendpoint","name":"DTLSEndpoint","title":"Class: `DTLSEndpoint`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"Manages a UDP socket and multiplexes DTLS sessions.","summary":"Manages a UDP socket and multiplexes DTLS sessions.","examples":[],"children":[{"kind":"property","id":"endpointaddress","name":"address","title":"`endpoint.address`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"`{ address, family, port }`\n\nThe local address the endpoint is bound to.","summary":"The local address the endpoint is bound to.","examples":[],"children":[]},{"kind":"property","id":"endpointstate","name":"state","title":"`endpoint.state`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"DTLSEndpointState","links":[]},"default":null,"description":"Shared state object with properties:\n\n* `bound` {boolean}\n* `listening` {boolean}\n* `closing` {boolean}\n* `destroyed` {boolean}\n* `sessionCount` {number}\n* `busy` {boolean}","summary":"Shared state object with properties:","examples":[],"children":[]},{"kind":"property","id":"endpointstats","name":"stats","title":"`endpoint.stats`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"DTLSEndpoint.Stats","links":[{"name":"DTLSEndpoint.Stats","href":"DTLSEndpoint.html#class-dtlsendpointstats","start":0,"end":18}]},"default":null,"description":"The statistics collected for this endpoint. Read only. The stats object is\nlive and updated by the C++ internals as data flows through the endpoint.","summary":"The statistics collected for this endpoint. Read only. The stats object is live and updated by the C++ internals as data flows through the endpoint.","examples":[],"children":[]},{"kind":"property","id":"endpointbusy","name":"busy","title":"`endpoint.busy`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"When `true`, the endpoint rejects new incoming connections. Can be set\nto implement backpressure.","summary":"When `true`, the endpoint rejects new incoming connections. Can be set to implement backpressure.","examples":[],"children":[]},{"kind":"method","id":"endpointclose","name":"close","title":"`endpoint.close()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"Resolves when the endpoint is fully closed."}},"description":"Gracefully closes the endpoint. All active sessions are closed with\n`close_notify` alerts before the UDP socket is released.","summary":"Gracefully closes the endpoint. All active sessions are closed with `close_notify` alerts before the UDP socket is released.","examples":[],"children":[]},{"kind":"method","id":"endpointdestroyerror","name":"destroy","title":"`endpoint.destroy([error])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"error","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Immediately destroys the endpoint without sending `close_notify` alerts.","summary":"Immediately destroys the endpoint without sending `close_notify` alerts.","examples":[],"children":[]},{"kind":"property","id":"endpointclosed","name":"closed","title":"`endpoint.closed`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"default":null,"description":"Resolves when the endpoint has fully closed.","summary":"","examples":[],"children":[]},{"kind":"method","id":"endpointsymbolasyncdispose","name":"[Symbol.asyncDispose]","title":"`endpoint[Symbol.asyncDispose]()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Equivalent to calling `endpoint.close()`.","summary":"Equivalent to calling `endpoint.close()`.","examples":[],"children":[]}]},{"kind":"class","id":"class-dtlsendpointstats","name":"Stats","title":"Class: `DTLSEndpoint.Stats`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"A view of the collected statistics for an endpoint.","summary":"A view of the collected statistics for an endpoint.","examples":[],"children":[{"kind":"property","id":"endpointstatscreatedat","name":"createdAt","title":"`endpointStats.createdAt`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"A timestamp indicating when the endpoint was created. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"endpointstatsdestroyedat","name":"destroyedAt","title":"`endpointStats.destroyedAt`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"A timestamp indicating when the endpoint was destroyed. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"endpointstatsbytesreceived","name":"bytesReceived","title":"`endpointStats.bytesReceived`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The total number of bytes received by this endpoint. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"endpointstatsbytessent","name":"bytesSent","title":"`endpointStats.bytesSent`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The total number of bytes sent by this endpoint. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"endpointstatspacketsreceived","name":"packetsReceived","title":"`endpointStats.packetsReceived`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The total number of UDP packets received by this endpoint. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"endpointstatspacketssent","name":"packetsSent","title":"`endpointStats.packetsSent`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The total number of UDP packets sent by this endpoint. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"endpointstatsserversessions","name":"serverSessions","title":"`endpointStats.serverSessions`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The total number of peer-initiated sessions accepted by this\nendpoint. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"endpointstatsclientsessions","name":"clientSessions","title":"`endpointStats.clientSessions`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The total number of sessions initiated by this endpoint. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"endpointstatsserverbusycount","name":"serverBusyCount","title":"`endpointStats.serverBusyCount`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The total number of incoming connections rejected because the\nendpoint was marked busy. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"endpointstatsisconnected","name":"isConnected","title":"`endpointStats.isConnected`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"`true` if the stats object is still connected to the underlying endpoint.\nOnce the endpoint is destroyed, the stats become a stale snapshot.","summary":"`true` if the stats object is still connected to the underlying endpoint. Once the endpoint is destroyed, the stats become a stale snapshot.","examples":[],"children":[]}]},{"kind":"class","id":"class-dtlssession","name":"DTLSSession","title":"Class: `DTLSSession`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"Represents a DTLS association with a single remote peer.","summary":"Represents a DTLS association with a single remote peer.","examples":[],"children":[{"kind":"method","id":"sessionsenddata","name":"send","title":"`session.send(data)`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"data","type":{"text":"string | Buffer","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"Buffer","href":"buffer.html#class-buffer","start":9,"end":15}]},"description":"The data to send.","default":null,"optional":false,"rest":false,"properties":[]}],"returns":{"type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"The number of bytes written to the DTLS layer."}},"description":"Send application data to the peer. The data is encrypted by DTLS before\nbeing sent over UDP. Can only be called after the handshake completes\n(`session.opened` has resolved).","summary":"Send application data to the peer. The data is encrypted by DTLS before being sent over UDP. Can only be called after the handshake completes (`session.opened` has resolved).","examples":[],"children":[]},{"kind":"method","id":"sessionclose","name":"close","title":"`session.close()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":{"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"description":"Resolves when the session is closed."}},"description":"Initiates a graceful DTLS shutdown by sending a `close_notify` alert.","summary":"Initiates a graceful DTLS shutdown by sending a `close_notify` alert.","examples":[],"children":[]},{"kind":"method","id":"sessiondestroyerror","name":"destroy","title":"`session.destroy([error])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"error","type":null,"description":"","default":null,"optional":true,"rest":false,"properties":[]}],"returns":null},"description":"Immediately destroys the session without sending `close_notify`.","summary":"Immediately destroys the session without sending `close_notify`.","examples":[],"children":[]},{"kind":"property","id":"sessionopened","name":"opened","title":"`session.opened`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"default":null,"description":"Resolves with `{ protocol }` when the DTLS handshake completes.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionclosed","name":"closed","title":"`session.closed`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Promise","links":[{"name":"Promise","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise","start":0,"end":7}]},"default":null,"description":"Resolves when the session is fully closed.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionremoteaddress","name":"remoteAddress","title":"`session.remoteAddress`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"`{ address, family, port }`","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionprotocol","name":"protocol","title":"`session.protocol`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"default":null,"description":"The negotiated DTLS protocol version\n(e.g., `'DTLSv1.2'`).","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessioncipher","name":"cipher","title":"`session.cipher`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Object","links":[{"name":"Object","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object","start":0,"end":6}]},"default":null,"description":"`{ name, standardName, version }`","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionpeercertificate","name":"peerCertificate","title":"`session.peerCertificate`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string | undefined","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"undefined","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type","start":9,"end":18}]},"default":null,"description":"The peer's certificate in PEM format.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionalpnprotocol","name":"alpnProtocol","title":"`session.alpnProtocol`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string | undefined","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"undefined","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type","start":9,"end":18}]},"default":null,"description":"The negotiated ALPN protocol.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionsrtpprofile","name":"srtpProfile","title":"`session.srtpProfile`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"string | undefined","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6},{"name":"undefined","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#undefined_type","start":9,"end":18}]},"default":null,"description":"The negotiated SRTP protection profile name.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionstats","name":"stats","title":"`session.stats`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"DTLSSession.Stats","links":[{"name":"DTLSSession.Stats","href":"DTLSSession.html#class-dtlssessionstats","start":0,"end":17}]},"default":null,"description":"The statistics collected for this session. Read only. The stats object is\nlive and updated as data flows through the session.","summary":"The statistics collected for this session. Read only. The stats object is live and updated as data flows through the session.","examples":[],"children":[]},{"kind":"method","id":"sessionexportkeyingmateriallength-label-context","name":"exportKeyingMaterial","title":"`session.exportKeyingMaterial(length, label[, context])`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[{"name":"length","type":{"text":"number","links":[{"name":"number","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#number_type","start":0,"end":6}]},"description":"Number of bytes to export.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"label","type":{"text":"string","links":[{"name":"string","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#string_type","start":0,"end":6}]},"description":"The label for the exported keying material.","default":null,"optional":false,"rest":false,"properties":[]},{"name":"context","type":{"text":"Buffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6}]},"description":"Optional context value.","default":null,"optional":true,"rest":false,"properties":[]}],"returns":{"type":{"text":"Buffer","links":[{"name":"Buffer","href":"buffer.html#class-buffer","start":0,"end":6}]},"description":""}},"description":"Exports keying material from the DTLS session, as defined in\n[RFC 5705](https://www.rfc-editor.org/rfc/rfc5705). This is commonly used with DTLS-SRTP to derive\nencryption keys for media streams.","summary":"Exports keying material from the DTLS session, as defined in RFC 5705. This is commonly used with DTLS-SRTP to derive encryption keys for media streams.","examples":[],"children":[]}]},{"kind":"class","id":"class-dtlssessionstats","name":"Stats","title":"Class: `DTLSSession.Stats`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"extends":null,"description":"A view of the collected statistics for a session.","summary":"A view of the collected statistics for a session.","examples":[],"children":[{"kind":"property","id":"sessionstatscreatedat","name":"createdAt","title":"`sessionStats.createdAt`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"A timestamp indicating when the session was created. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionstatsdestroyedat","name":"destroyedAt","title":"`sessionStats.destroyedAt`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"A timestamp indicating when the session was destroyed. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionstatsclosingat","name":"closingAt","title":"`sessionStats.closingAt`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"A timestamp indicating when `close()` was called. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionstatshandshakecompletedat","name":"handshakeCompletedAt","title":"`sessionStats.handshakeCompletedAt`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"A timestamp indicating when the DTLS handshake completed. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionstatsbytesreceived","name":"bytesReceived","title":"`sessionStats.bytesReceived`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The total number of application data bytes received. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionstatsbytessent","name":"bytesSent","title":"`sessionStats.bytesSent`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The total number of application data bytes sent. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionstatsmessagesreceived","name":"messagesReceived","title":"`sessionStats.messagesReceived`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The total number of application messages received. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionstatsmessagessent","name":"messagesSent","title":"`sessionStats.messagesSent`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The total number of application messages sent. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionstatsretransmitcount","name":"retransmitCount","title":"`sessionStats.retransmitCount`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"bigint","links":[{"name":"bigint","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#bigint_type","start":0,"end":6}]},"default":null,"description":"The total number of DTLS handshake retransmissions. Read only.","summary":"","examples":[],"children":[]},{"kind":"property","id":"sessionstatsisconnected","name":"isConnected","title":"`sessionStats.isConnected`","scope":"module","overloadOf":null,"stability":null,"added":["v26.9.0"],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"boolean","links":[{"name":"boolean","href":"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#boolean_type","start":0,"end":7}]},"default":null,"description":"`true` if the stats object is still connected to the underlying session.\nOnce the session is destroyed, the stats become a stale snapshot.","summary":"`true` if the stats object is still connected to the underlying session. Once the session is destroyed, the stats become a stale snapshot.","examples":[],"children":[]},{"kind":"section","id":"callback-properties","name":"Callback properties","title":"Callback properties","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"","summary":"","examples":[],"children":[{"kind":"property","id":"sessiononmessage","name":"onmessage","title":"`session.onmessage`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"default":null,"description":"Set to receive application data from the peer.","summary":"Set to receive application data from the peer.","examples":[],"children":[]},{"kind":"property","id":"sessiononerror","name":"onerror","title":"`session.onerror`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"default":null,"description":"Set to receive error notifications.","summary":"Set to receive error notifications.","examples":[],"children":[]},{"kind":"property","id":"sessiononhandshake","name":"onhandshake","title":"`session.onhandshake`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"default":null,"description":"Set to receive handshake completion notifications.","summary":"Set to receive handshake completion notifications.","examples":[],"children":[]},{"kind":"property","id":"sessiononkeylog","name":"onkeylog","title":"`session.onkeylog`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"type":{"text":"Function","links":[{"name":"Function","href":"https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Function","start":0,"end":8}]},"default":null,"description":"Set to receive TLS key log lines (for debugging with Wireshark).","summary":"Set to receive TLS key log lines (for debugging with Wireshark).","examples":[],"children":[]}]},{"kind":"method","id":"sessionsymbolasyncdispose","name":"[Symbol.asyncDispose]","title":"`session[Symbol.asyncDispose]()`","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"signature":{"parameters":[],"returns":null},"description":"Equivalent to calling `session.close()`.","summary":"Equivalent to calling `session.close()`.","examples":[],"children":[]}]},{"kind":"section","id":"dtls-srtp-example","name":"DTLS-SRTP example","title":"DTLS-SRTP example","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"DTLS-SRTP is used by WebRTC for media encryption. The DTLS handshake\nnegotiates the SRTP protection profile and provides keying material.\n\n```mjs\nimport { listen, connect } from 'node:dtls';\nimport { readFileSync } from 'node:fs';\n\n// Server with SRTP\nconst server = listen((session) => {\n  session.onhandshake = () => {\n    console.log('SRTP profile:', session.srtpProfile);\n    const keys = session.exportKeyingMaterial(\n      60,\n      'EXTRACTOR-dtls_srtp',\n    );\n    console.log('SRTP keying material:', keys);\n  };\n}, {\n  cert: readFileSync('server-cert.pem'),\n  key: readFileSync('server-key.pem'),\n  port: 5004,\n  srtp: 'SRTP_AES128_CM_SHA1_80:SRTP_AEAD_AES_128_GCM',\n});\n\n// Client with SRTP\nconst session = connect('localhost', 5004, {\n  rejectUnauthorized: false,\n  srtp: 'SRTP_AEAD_AES_128_GCM:SRTP_AES128_CM_SHA1_80',\n});\n\nawait session.opened;\nconsole.log('Negotiated SRTP:', session.srtpProfile);\nconst keys = session.exportKeyingMaterial(60, 'EXTRACTOR-dtls_srtp');\n```","summary":"DTLS-SRTP is used by WebRTC for media encryption. The DTLS handshake negotiates the SRTP protection profile and provides keying material.","examples":[{"language":"mjs","displayName":null,"code":"import { listen, connect } from 'node:dtls';\nimport { readFileSync } from 'node:fs';\n\n// Server with SRTP\nconst server = listen((session) => {\n  session.onhandshake = () => {\n    console.log('SRTP profile:', session.srtpProfile);\n    const keys = session.exportKeyingMaterial(\n      60,\n      'EXTRACTOR-dtls_srtp',\n    );\n    console.log('SRTP keying material:', keys);\n  };\n}, {\n  cert: readFileSync('server-cert.pem'),\n  key: readFileSync('server-key.pem'),\n  port: 5004,\n  srtp: 'SRTP_AES128_CM_SHA1_80:SRTP_AEAD_AES_128_GCM',\n});\n\n// Client with SRTP\nconst session = connect('localhost', 5004, {\n  rejectUnauthorized: false,\n  srtp: 'SRTP_AEAD_AES_128_GCM:SRTP_AES128_CM_SHA1_80',\n});\n\nawait session.opened;\nconsole.log('Negotiated SRTP:', session.srtpProfile);\nconst keys = session.exportKeyingMaterial(60, 'EXTRACTOR-dtls_srtp');"}],"children":[]},{"kind":"section","id":"mtu-considerations","name":"MTU considerations","title":"MTU considerations","scope":"module","overloadOf":null,"stability":null,"added":[],"deprecated":[],"removed":[],"napiVersion":[],"changes":[],"description":"Since libuv does not currently support path MTU discovery, the DTLS module\nuses a conservative default MTU of 1200 bytes. This value works across\nvirtually all network paths but may be suboptimal for local networks.\n\nThe MTU can be configured via the `mtu` option:\n\n```mjs\n// For a local network where you know the path MTU\nconst endpoint = listen(callback, {\n  // ...\n  mtu: 1400,\n});\n```\n\nThe minimum allowed MTU is 256 bytes. The maximum is 65535.","summary":"Since libuv does not currently support path MTU discovery, the DTLS module uses a conservative default MTU of 1200 bytes. This value works across virtually all network paths but may be suboptimal for local networks.","examples":[{"language":"mjs","displayName":null,"code":"// For a local network where you know the path MTU\nconst endpoint = listen(callback, {\n  // ...\n  mtu: 1400,\n});"}],"children":[]}]}