Full-featured Socket.IO client implementation for NativeScript.
This library is production-ready. Both Android and iOS implementations are stable and in sync.
Please check releases and changelog and roadmap for more information.
Android: Socket.IO-client Java v1.*
iOS: Socket.IO-Client-Swift v12.*
tns plugin add nativescript-socket.io
const SocketIO = require('nativescript-socket.io');
SocketIO.enableDebug(); // optionnal
// or use your own debug function
// SocketIO.enableDebug(myCustomDebugFunction);
const options = {
query: {
token: 'SOME_TOKEN_HERE',
},
android: {
// http://socketio.github.io/socket.io-client-java/apidocs/io/socket/client/IO.Options.html
}
ios: {
// https://nuclearace.github.io/Socket.IO-Client-Swift/Enums/SocketIOClientOption.html
}
};
const socketio = SocketIO.connect('http://somewhere/namespace', options);
socketio.on('connect', function(){
console.log('connect');
});
socketio.on('hello', function(){
console.log('hello', arguments);
});
socketio.on('request', function(info, ack){
console.log('request', info);
if (info === 'datetime') {
ack(new Date());
} elseif (info === 'random') {
ack(Math.random());
} else {
ack(null);
}
});
socketio.emit('hello', {
username: 'someone',
});
socketio.emit('hello-ack', {
username: 'someone',
}, function ack(){
console.log('hello-ack', arguments);
})
import using either of the following:
import * as SocketIO from "nativescript-socket.io"`
// OR
const SocketIO = require("nativescript-socket.io")
replace all instance of 192.168.1.111
with your IP address or domain.
start the socket.io demo server
cd ./demo.server
npm start
cd ./demo
tns run android
转自:https://cnodejs.org/topic/5492ba8b61491ead0cc7c018 socket.io实战 https://socket.io/docs/using-multiple-nodes/ nodejs mult process + nginx + redis + socket.io 实现c50K,目前正在优化app,希望能实现c100K. 目前 c50K 非常稳定
socket.io-client相比SocketIO.jar使用起来更方便一点 public void connection(final MapAction _action) { try { IO.Options opts = new IO.Options(); opts.query = "w_auth_key=" +LoginActivity.socket
原创文章转载请注明来源:https://blog.csdn.net/weixin_41756573/article/details/88697343 1.错误信息 java.io.NotSerializableException: com.system.boot.domain.Emp at java.io.ObjectOutputStream.writeObject0(ObjectOutp
NativeScript 可以使用 Javascript,CSS, XML 创建真正的 Native 跨平台应用,支持 iOS Android,NativeScript 将您的跨平台代码翻译成目标平台的代码。 UI 使用 XML 描述,CSS 样式,在编译时将 UI 转化成本地原生代码,最终得到正在的 Native 原生应用。 Telerik 公开了用于创建安卓、iOS和Windows Unive
NativeScript Command-Line Interface The NativeScript CLI lets you create, build, and deploy NativeScript-based apps on iOS and Android devices. Get it using: npm install -g nativescript What is Native
NativeScript-Snackbar �� �� �� NativeScript plugin for Material Design SnackBar component. Installation: NativeScript 7+:tns plugin add @nstudio/nativescript-snackbar NativeScript version prior to 7:t
Nativescript-Ripple This plugin aims to bring a native (or close to native) ripple implementation on Android and iOS. The android version uses a RippleDrawable and conserves the previous background, a
NativeScript-FloatingActionButton NativeScript plugin for Material Design Floating Action Button UI component. Installation Nativescript 7+: ns plugin add @nstudio/nativescript-floatingactionbutton Na
NativeScript CardView A NativeScript plugin to provide an XML widget to implement the Material Design CardView component. Installation NativeScript 7+: ns plugin add @nstudio/nativescript-cardview Nat