Skip to content

Releases

Ti.Socketline 1.0.0

Choose a tag to compare

@joshualambert joshualambert released this 12 Nov 15:22

A native WebSocket client for Titanium, on iOS and Android: ws:// and wss:// with the platform's own TLS, text frames, and the same events and close codes on both platforms.

Requires Titanium SDK 13.0.0.GA or later, iOS 15 or later, Android 7.0 (API 24) or later.

Install

Unzip the zips for your platforms into your project root, then add <module>ti.socketline</module> to tiapp.xml. See the README for usage, the event and close-code contract, and what was verified.

Changes

Initial release.

  • createSocket({ url, protocols, headers, connectTimeout }) with
    connect(), send(text), close([code], [reason]), readyState, protocol
    and url
  • open (protocol), message (data), error (code, error) and close
    (code, reason, wasClean) events, identical on iOS and Android: close
    exactly once and last; 1006 for anything that never opened; wasClean when the
    connection ended with a close frame (the server's, or the app's after close());
    1005 for a server close frame without a code
  • connectTimeout is a deadline for DNS, TCP, TLS and the upgrade on both
    platforms
  • ws:// follows the app's cleartext policy on both platforms: the network security
    config on Android, the App Transport Security settings on iOS (applied by the
    module, since NSURLSessionWebSocketTask does not)
  • Subprotocols through protocols, checked against the server's answer
  • close() validates its arguments (1000 or 3000-4999, a reason of at most 123
    UTF-8 bytes) and throws on invalid ones; close() while connecting stops the
    connection
  • Binary frames are dropped with a BINARY_FRAME error, never delivered as text
  • iOS: NSURLSessionWebSocketTask (iOS 15+), all state on the main queue
  • Android: the platform's TLS (TLS 1.3, network security config, host name
    verification) and cleartext policy, with Java-WebSocket 1.5.3 (shared with
    Titanium itself) for the upgrade and framing
  • 16 KB page-size aligned Android binaries; the zips include the LICENSE
  • Unit tests for the state machine and validation on both platforms
    (test/vectors.json), and an example app whose self-test runs against a local
    test server

Checksums (sha256)

9a0b64c05d3e419ef6ddd4bf75213880ee5565d4fd665b95b94ae1d12ce897af  ti.socketline-android-1.0.0.zip
b3bb3294b52b2a5521a1aca8f95a5911078d9843414a0b7026f0e7d5cddfb7e4  ti.socketline-iphone-1.0.0.zip

Built from commit 8cfd285 with Titanium SDK 13.4.1.GA.