All Projects → appcelerator-modules → titanium-socketio

appcelerator-modules / titanium-socketio

Licence: Apache-2.0 license
Use the native Socket.io SDK's with Axway Titanium.

Programming Languages

javascript
184084 projects - #8 most used programming language
objective c
16641 projects - #2 most used programming language
java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to titanium-socketio

SocketIOSharp
C# implementation of Socket.IO protocol revision 4 client and server.
Stars: ✭ 101 (+304%)
Mutual labels:  socket-io, socketio, socketio-client
socket.io-client-core
High-Performance Socket.IO client in C#
Stars: ✭ 70 (+180%)
Mutual labels:  socket-io, socketio, socketio-client
VPSocketIO
socket.io client objective-c
Stars: ✭ 18 (-28%)
Mutual labels:  socket-io, socketio, socketio-client
Bizsocket
异步socket,对一些业务场景做了支持
Stars: ✭ 469 (+1776%)
Mutual labels:  socket-io, socketio
bubbly
Full stack chat application created w/ Next.js, Socket.IO, Express, React and TypeScript
Stars: ✭ 24 (-4%)
Mutual labels:  socket-io, socketio
boltly
Boltly: The complete Socket.io test client!
Stars: ✭ 16 (-36%)
Mutual labels:  socket-io, socketio
gobang
五子棋小游戏canvas socket.io
Stars: ✭ 38 (+52%)
Mutual labels:  socket-io, socketio
Phpsocket.io
A server side alternative implementation of socket.io in PHP based on workerman.
Stars: ✭ 2,026 (+8004%)
Mutual labels:  socket-io, socketio
Socket.io Python Emitter
Python implementation of socket.io-emitter
Stars: ✭ 67 (+168%)
Mutual labels:  socket-io, socketio
Socketio Wildcard
socket.io v2.x with a wildcard event
Stars: ✭ 185 (+640%)
Mutual labels:  socket-io, socketio
Node Decorators
node-decorators
Stars: ✭ 230 (+820%)
Mutual labels:  socket-io, socketio
realtime-geolocation
Geolocation tracking app with Node.js, Socket.io, & AngularJS
Stars: ✭ 29 (+16%)
Mutual labels:  socket-io, socketio
SocketIOUnity
A Wrapper for socket.io-client-csharp to work with Unity.
Stars: ✭ 69 (+176%)
Mutual labels:  socket-io, socketio
django-channels-with-socket.io
django channels with socket.io
Stars: ✭ 23 (-8%)
Mutual labels:  socket-io, socketio
Go Socket.io
A Socket.IO backend implementation written in Go
Stars: ✭ 409 (+1536%)
Mutual labels:  socket-io, socketio
Aaronvandenberg.nl
⚛️ Web Developers portfolio build with Gatsby.js & React.js
Stars: ✭ 98 (+292%)
Mutual labels:  socket-io, socketio
Python Socketio
Python Socket.IO server and client
Stars: ✭ 2,655 (+10520%)
Mutual labels:  socket-io, socketio
pdfdraw
Nextcloud app to annotate PDF documents
Stars: ✭ 32 (+28%)
Mutual labels:  socket-io, socketio
vue-socket-io-example
Vue + Socket.io for the masses
Stars: ✭ 28 (+12%)
Mutual labels:  socketio, socketio-client
vue-feathers-chat
A sample realtime chat made with Vue and Feathers.
Stars: ✭ 50 (+100%)
Mutual labels:  socket-io

Socket.io client for Titanium

Socket.IO module for Titanium using native Android and iOS clients.

Requirements

  • Android: Titanium SDK 9.0.0+
  • iOS: Titanium SDK 7.4.0+ / Xcode 10.2 / Swift 5.0+

💡 The iOS module is built with Swift 5.0 and you need to have the same Swift version installed to be able to use this module. You can check your current Swift version by using swift -v from the terminal.

💡 The Android module version 4.x will support Socket.io Server 3.x/4.x

Getting started

Install the module to your project or globally by copying it into the modules folder. After that enable it in your tiapp.xml.

<modules>
  <module platform="android">ti.socketio</module>
  <module platform="iphone">ti.socketio</module>
</modules>

Usage

This module aims to be as compatible with the web client as possible. Please refer to the Client API for a full API documentation of all supported methods.

const io = require('ti.socketio');
const socket = io.connect('http://localhost:8080');
socket.on('connect', function() {
  Ti.API.debug('socket connected');

  socket.emit('hello', 'world');
});

Currently supported methods and properties are:

IO

  • io(url[, options]) (exposed as connect, note that url is not optional)
  • socket.id
  • socket.connected
  • socket.disconnected
  • socket.io
  • socket.open()
  • socket.connect()
  • socket.emit(eventName[, ...args][, ack])
  • socket.on(eventName, callback) (Note: Using acknowledgement callbacks not supported yet)
  • socket.off([eventName], [fn])
  • socket.close()
  • socket.disconnect()

Manager

  • Manager(url[, options]) (note that url is not optional)
  • manager.socket(nsp) (options are not supportedl)
  • manager.open() (callback is not supported)
  • manager.connect()
  • manager.close() (noop on Android, all sockets need to be closed individually)
  • manager.dsconnect()

You can pass the option keys from both JS and native when creating a new socket. But only options that are actually supported on the native side will be converted to the matching configuration option. For example the JS query option will be converted to the connectionParams option in the native iOS framework.

Limitations

Due to different architecture of the native frameworks and the web client there are a few things you need to be aware of when using this module.

Events on iOS

The native clients don't have the concept of auto connect (which is the default for the web client). We emulate this by automatically connecting the socket for you if you don't explicitly specify autoConnect: false in the options.

However, this impacts emitting events on iOS where you need to explicity wait for a socket to be connected before you can start emitting events.

import io from 'ti.socketio';

const socket = io.connect('http://localhost');
socket.on('connect', () => {
  socket.emit('myevent');
});

This is due to a limitation in the iOS native client which discards any events before a socket is connected. The Android client will store events in a buffer and send them automatically once connected.

Missing events

  • reconnect (use connect instead)
  • reconnect_error (use error instead)
  • reconnect_failed (use error instead)

Other event notes

  • connect_error is the same as error. You need to check the error message to see what kind of error happened.
  • reconnect_attempt does not report the number of reconnect attempts.
  • pong does not report the number ms elapsed since ping.

Useful links

Based on the socket.io-client-java on Android and socket.io-client.swift on iOS.

Contributions

Open source contributions are greatly appreciated! If you have a bugfix, improvement or new feature, please create an issue first and submit a pull request against master.

Getting Help

If you have questions about the Socket.IO module for Titanium, feel free to reach out on Stackoverflow or the #helpme channel on TiSlack. In case you find a bug, create a new issue.

Legal

Titanium is a registered trademark of TiDev Inc. All Titanium trademark and patent rights were transferred and assigned to TiDev Inc. on 04/07/2022. Please see the LEGAL information about using our trademarks, privacy policy, terms of usage and other legal information at https://tidev.io/legal.

License

Titanium is licensed under the OSI approved Apache Public License (Version 2). All trademark rights were assigned to TiDev, Inc. on 04/07/2022 from Axway, Inc. Please see the LICENSE file for more details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].