const spgNamespace = io.of("/spg").use(verify());
I tried to find the API of()
and use()
w.r.t Javascript and socket.io. I am unsuccessful.
I found this link: https://socket.io/docs/v3/namespaces/index.html
But they have not explained the use of API of()
and use()
.
I have learnt that of()
function is related to promises but this link doesn't have anything related to it: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise
This SO thread says that use()
function is related to adonisJS
but my project is not using this library anywhere: what is the 'use' keyword in javascript?
In this code, io
is the object of 'socket.io'.
const spgNamespace = io.of("/spg").use(verify());
Please explain what is this line doing and please point out the reference APIs.