Answer the question
In order to leave comments, you need to log in
NodeJS How to listen unix socket?
Good afternoon.
Task:
Listen to unix sockets in nodejs using nodejs "net" library. It is desirable to paint in detail, because I have no idea how to work with them at all.
Some kind of socket file is being created there, I don’t know how and what.
Thanks in advance!
Answer the question
In order to leave comments, you need to log in
const net = require('net')
// создаем сервер
const server = net.createServer(socket => {
console.log('connected') // клиент присоединился
socket.end('hello') // отвечаем и закрываем соединение
})
server.listen('/var/run/mysocket') // слушаем сокет
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question