hans00 / fastws Goto Github PK
View Code? Open in Web Editor NEWSimple Node.js server based on uWebSockets
License: Apache License 2.0
Simple Node.js server based on uWebSockets
License: Apache License 2.0
can you benchmark this vs socket io, I really wanted to use this newly renamed uws xD but looking for a beautiful wrapper that I can fully understand.
Currently uWebSocket.js is using V8 API.
Consider to use N-API will get more compatibility.
Hi,
I've just gotten around to recompiling this package. There appears to be no guides available. which would be rather helpful.
On Windows one must install msys2 or WSL in order to provide the missing 'ls' command.
My process to install on Windows:
- Download vs2017 from website: https://visualstudio.microsoft.com/vs/older-downloads/
- Download and install msys2. Open it and type 'pacman -Syu', close and run this step again to finish updating.
- Add this path to the PATH environment variable 'C:\msys64\usr\bin'
- Run these commands to setup your vs2017 environment:
npm config set msvs_version 2017 –global (not sure if required)
npm config set python python2.7 (not sure if required)
- Run 'npm install -S fast-ws'
My process on Ubuntu: (untested)
- Run: 'sudo apt-get install build-essential'
- Run: 'sudo npm install -g node-gyp'
I'm running a simple server based on the examples:
const fastWS = require('fast-ws/server');
const options = {};
const app = new fastWS(options)
app.ws('/db', ws => {
console.log(`Connected ${ws.remoteAddress}`)
ws.on('message', ({ data }) => {
console.log(`Received: ${data}`);
ws.sendMessage(data)
})
ws.on('echo', ({ reply, data }) => {
reply(data)
})
});
const [host, port] = ['127.0.0.1', 8080];
app.listen(host, port, () => {
console.log(`Listen on ${host}:${port}`)
})
Unfortunately, when I connect using the code below:
const Client = require('fast-ws/client')
const options = {
// Ping Interval (not less then server `idleTimeout`)
pingInterval: 30000, // Default (ms)
// Reply Timeout (Event reply)
replyTimeout: 5000, // Default (ms)
// parser options (same as server)
parserOptions: {},
// Others options for package 'ws'
};
const ws = new Client('ws://127.0.0.1:8080/db', options)
I get this output upon connection:
Connected 7f00:0001:
IPv6 is disabled, so I have no idea what this value actually is.
Cheers.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.