Support for unix sockets
Open
Nobody has claimed this yet.
enhancement
package:socket.io-client
- Dominant language
- TypeScript
- Stars
- 63.2k
- Forks
- 10.3k
- Avg merge
- 11d 20h
- Merged PRs (30d)
- 2
Description
Websockets has a support for unix sockets with a url like ws+unix:///path/to/file, but Socket.io doesn't seem to support it.
The server:
const path = './server.sock';
var app = require('http').createServer(function(req, res) {
console.log('Request for ' + req.url);
res.statusCode = 200;
res.setHeader('Content-Type', 'text/plain');
res.end('Hello World\n');
});
var io = require('socket.io')(app);
io.on('connection', function (socket) {
socket.emit('news', { hello: 'world' });
socket.on('my other event', function (data) {
console.log(data);
});
});
app.listen(path, function() {
console.log(`Server running at ${path}`);
});
...and client:
const path = './server.sock';
var socket = require('socket.io-client')('ws+unix://' + require('path').resolve(path));
socket.on('connect', function(){
console.log('connect');
});
socket.on('event', function(data){
console.log('event: ', data);
});
socket.on('disconnect', function(){
console.log('disconnect');
});
...but client doesn't connect...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing how the Socket.IO client parses connection URLs and how the Node.js server and client create their underlying connections. Reproduce the provided server.sock example, then add support and tests showing that a ws+unix URL connects successfully and preserves existing URL behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- backend, networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100