1.0.1 • Published 6 months ago

tiws v1.0.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months ago

tiws: a Titanium WebSocket library

Pure JavaScript based WebSocket client implementation for Titanium using Ti.Network.Socket.TCP. Can be used as a repalcement for ws on Titanium.

Install

npm i tiws
yarn add tiws

Usage

const WebSocket = require('tiws');

const ws = new WebSocket('ws://www.host.com/path');

ws.on('open', function open() {
  ws.send('something');
});

ws.on('message', function incoming(data) {
  console.log(data);
});

For more example see the usage examples of the original ws module.

Known Limitations

This module is heavily inspired by ws but is missing a few features since Titanium is not a full NodeJS compatible enviornment.

  • tiws only works as a WebSocket client. WebSocket.Server functionaily was not ported yet.
  • No support for secure WebSocket connections (wss:) yet. If you need this head over to titanium_mobile#11137 and upvote that issue so it receives more visibility.
  • Extended payload length of 64-bit integer not supported yet.
  • PerMessageDeflate extensions is not supported. There is no zip implementation available in Titanium to handle the (de)compression.