Building with NodeJS¶
Adding WebSockets to NodeJS¶
The easiest solution to make all libraries compatible is to add WebSockets to the global namespace.
We'll use the
isomorphic-ws library to add WebSockets to our Node app.
npm install --save isomorphic-ws ws
You can now just add WebSockets to the global namespace in your apps. Add this to the first line in your
ts files, usually
main.js or similar.
;(global as any).WebSocket = require('isomorphic-ws')
;global.WebSocket = require('isomorphic-ws')
That's it, now start building the full suite of Textile tools. Check out the app building tutorials for ideas.