Code Monkey home page Code Monkey logo

nativescript-socket.io's People

Contributors

agisboye avatar lfabreges avatar naderio avatar opada-eng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nativescript-socket.io's Issues

Strange behavior between Android and iOS

For android, after 5s or so, the socket is totally disconnected. And because of that, if i emit something from iOS, my android cannot receive any response. My backend server is in node.js with https

Everything works just fine in iOS, the socket remains open.

My package.json:
"angular/core": "4.2.5",
"nativescript-angular": "4.2.0",
"nativescript-socket.io": "^0.9.0"

And tns version:
"tns-android": {
"version": "3.4.0"
},
"tns-ios": {
"version": "3.4.0"
}

I have tried to add 'timeout' into the Option then the app crash silently. What are other available options to keep the socketio behave like iOS?

how to connect to https

how to connect to https example : https:demo.com:5808

how to connect to https, I've tried if http work but https failed

IO is not defined

Hello,
I have the same problem.
I already uninstall app my device, but a keep getting: "IO is not defined"

"nativescript-socket.io": "^0.9.0"

I need help, please
Thanks :D

reconnection

Hi,
Is the any way to stop automatically reconnection?
I already try {'reconnection': false} and {'reconnect': false} inside option but none works
Best regards

io is not defined

Currently, I have a working up based on the nativescript grocery store tutorial.

When I add the nativescript-socket.io plugin via
tns plugin add nativescript-socket.io
the package installs.

I import with
import {SocketIO} from 'nativescript-socket.io';

then try to connect to the socket in the ngOnInit() function:
this.socket = new SocketIO('http://192.168.0.12:8000'); this.socket.connect();

however, the app never reaches this point but exits with the error:
ReferenceError: io is not defined

I use typescript 2.0,

following is the package.json:

{ "name": "DontWait", "version": "1.0.0", "description": "A NativeScript-built iOS and Android app for managing grocery lists", "repository": { "type": "git", "url": "https://github.com/nativescript/sample-Groceries.git" }, "keywords": [ "NativeScript" ], "author": "TJ VanToll <[email protected]> (http://tjvantoll.com/)", "license": "MIT", "bugs": { "url": "https://github.com/nativescript/sample-Groceries/issues" }, "homepage": "https://github.com/nativescript/sample-Groceries/groceries", "nativescript": { "id": "org.nativescript.groceries", "tns-ios": { "version": "2.3.0" }, "tns-android": { "version": "2.3.0" } }, "dependencies": { "@angular/common": "2.0.0", "@angular/compiler": "2.0.0", "@angular/core": "2.0.0", "@angular/http": "2.0.0", "@angular/platform-browser": "2.0.0", "@angular/platform-browser-dynamic": "2.0.0", "@angular/platform-server": "2.0.0", "@angular/router": "3.0.0", "email-validator": "^1.0.7", "nativescript-angular": "1.0.0", "nativescript-social-share": "^1.3.1", "nativescript-socket.io": "0.3.0", "reflect-metadata": "0.1.8", "rxjs": "5.0.0-beta.12", "socket.io": "^1.6.0", "socket.io-client": "^1.6.0", "tns-core-modules": "2.3.0" }, "devDependencies": { "babel-traverse": "6.7.6", "babel-types": "6.7.7", "babylon": "6.7.0", "filewalker": "0.1.2", "lazy": "1.0.11", "nativescript-dev-typescript": "^0.3.2", "typescript": "^2.0.10", "zone.js": "0.6.21" } }

Let me know if there is important information I left out.
Thanks for any hint!
Patrick

Sorry, this is a duplicate of
#5
so i closed it

IO is not defined

So.. All I did was

tns plugin add nativescript-socket.io

To install the plugin.

When I

const SocketIO = require('nativescript-socket.io');

It simply tells me io is not defined (last line of log)

It appears that the declaration of io var has no real value on the ES2015 equivalent.

iOS version not working.

I managed to make it work on android, and it's working pretty well. But iOS version just wont connect when I call the socket.on('connect', data => {...} );.

Any help on this would be appreciated.
Thanks

strange behavior can't build nativescript-socket.io

when running tns run android. this happens:

Unable to apply changes on device: 192.168.56.101:5555. Error is: Failed to build plugin nativescript-socket.io :
Error: Command ./gradlew failed with exit code 1 Error output:
Exception in thread "main" java.lang.RuntimeException: Timeout of 120000 reached waiting for exclusive access to file: /Users/pedroteran/.gradle/wrapper/dists/gradle-4.4-bin/bgaq7vklkazwgxox0hdadxbvi/gradle-4.4-bin.zip
at org.gradle.wrapper.ExclusiveFileAccessManager.access(ExclusiveFileAccessManager.java:65)
at org.gradle.wrapper.Install.createDist(Install.java:48)
at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:107)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
.

node version 7.7.4.
npm version 4.1.2

doess anyone knows why this could happen?

Connection to server is disconnected when ios app switch to background

Hello,
We are developing a chat application, which requires socket IO to work in background.
Whenever the app is in background and any message is received, notification must be fired to notify user of incoming message.
But, connection to server is lost in background mode.
We checked server logs too,which shows "Disconnected" event fired.

Does anyone has any idea of how to keep connection alive while app is in background ?

namespaces problem on IOS

@naderio

I'm using the plugin nativescript-socket.io which uses:
socket.io-client-swift version 11.0

pod 'Socket.IO-Client-Swift', '~> 11.0'

  and I can not work with namespaces. However, you can work with namespaces about:

socket.io-client-swift version 12.1.1 onwards ...

Could you do something about it?

Use websocket only on android

Hello, i'm using this code client side to connect on my clusterised socket io server

socketio = SocketIO.connect('http://IP/app', { query: 'token=' + token, forceNew: true, secure: false, android: { transports: ['websocket', 'polling'], }, ios: { transports: ['websocket', 'polling'], forceWebsockets: true, } });
But even with that my server receive connection trying to use polling and trigger a transport error because polling with clustering isn't compatible. How can I ensure that my client won't try polling at all?

Won't connect on Android but does on IOS

I've developed my app for ios and trying to port it to Android but nativescript-socket.io won't connect, I narrowed the problem down to a simple hello world from the templates with only the nativescript-socket.io plugin. It works with IOS but not with Android. I get silent errors

running this bit of code :

export class AppComponent 
{
    socket;
    constructor()
    {
            console.log('constructor!');    
            this.socket = SocketIO.connect('https://eaglecar.org');
            this.socket.on('connect', ()=>
            {
                console.log('Connect!');
            });

            this.socket.on('error', (error) => 
            {
                console.log('Error!');
                console.log(error);
            });      
    }
}

For information, this connects to a server with a let's encrypt ssl certificate.

IOS console output

CONSOLE LOG file:///app/app.component.js:8:20: constructor!
CONSOLE LOG file:///app/tns_modules/@angular/core/./bundles/core.umd.js:3053:20: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
CONSOLE LOG file:///app/tns_modules/nativescript-socket.io/common.js:41:22: nativescript-socket.io on connect []
CONSOLE LOG file:///app/app.component.js:11:24: Connect!

But with Android

it silently fails given neither Connect! nor Error!

JS: constructor!
JS: Angular is running in the development mode. Call enableProdMode() to enable the production mode.

At first I was thinking about a timing error, so I tried to attach the connect to a UI callback, the function gets called but with no errors.

Can't find anything interresting with adb logcat but this, seems normal :

08-04 15:10:24.377 11162 11162 V JS      : constructor!
08-04 15:10:24.386 11162 11193 D NetworkSecurityConfig: No Network Security Config specified, using platform default
08-04 15:10:24.389 11162 11195 I System.out: (HTTPLog)-Static: isSBSettingEnabled false
08-04 15:10:24.389 11162 11195 I System.out: (HTTPLog)-Static: isSBSettingEnabled false

Just tried to change the connecting domain to something that does not exist and still no error in the console...

Additional tests :

2 tests I made :

I successfully loaded an image over https in the same app on the same server with the same certificate
I successfully connected to a non secure socket.io server on another port (3000) on Android.

Server side

var fs = require('fs');
var options = {
    key:    fs.readFileSync('../ssl/keys/[this_is_a_valid_key].key'),
    cert:   fs.readFileSync('../ssl/certs/[this_is_a_valid_cert].crt')
};


var server = require('https').createServer(options);
server.listen(443,'eaglecar.org');
var io = require('socket.io').listen(server);


io.on('connection', function(socket){
  console.log('connected!!');
});

MalformedURLException when attempting to connect using websockets

when building an android app, calling to connect to a secure websocket URI fails:

var SocketIO = require('nativescript-socket.io').SocketIO;
..
var socket = new SocketIO('wss://api.serverbeta.com:8118', { transport: websockets, reconnection: true, secure:true });
this.socket = socket;
..
socket.connect();

Is there a disconnect event?

Hi,

I have the following setup which connects to my API. The disconnect event never fires if I bring the API down. Is there some other way to check for this other than having an interval which checks socketio.connected? Thanks!

    const socketio = SocketIO.connect(this.API_HOST);

    socketio.on('connect', () => {
      console.log('SocketIO - CONNECTED');
      this.rootStore.socketStatus = SocketStatus.ONLINE;
    });

    socketio.on('disconnect', () => {
      console.log('SocketIO - DISCONNECTED');
      this.rootStore.socketStatus = SocketStatus.OFFLINE;
    });

Reconnection

Hi! thanks for the awesome plugin guys.

I have the following code, and I'd like to know which is the right way to handle reconnection.
I've tried automatic reconnection without success, I'm going to try a manual reconnection now and I'd like to know the proper way to do it.

Cheers!

                   const options = {
                        android: {
                            reconnection: false,
                        }
                    };

                    this.socketIO = SocketIO.connect(SocketBaseURL + '/socket_' + this.socket._id, options);
                    this.socketIO.on('connect', (socket) => {
                        console.log('Socket connected...');
                    });
                    this.socketIO.on('disconnect', (socket) => {
                        console.log('Socket DISCONNECTED...');
                    });
                    this.socketIO.on('connect_error', (socket) => {
                        console.log('Trouble connecting...');
                    });

Socket instance in multiple pages

hi @naderio a question, how can i use a socket instance in multiple pages, like socket is connected on login page then use that socket instance in a chat page which is actually a third page , i used the
{N} background sample App code in my app and i can get messages even after my App is killed! but to do it, the background service has to do a new connection, {N} apps takes up to 10 min running even after closing/exiting the app!! so the background service fails to connect until Android kills App! a workaround is i disconnect the socket on App close/exit which works fine until i click the notification which starts the App but the app's chat has no connection to the current socket connection made in the background service, in short i want to use a single socket instance in main thread (app) and background

Unable to use it on iOS

I get this error message in the console

file:///app/tns_modules/nativescript-socket.io/socketio.js:53:67: JS ERROR TypeError:
 SocketIOClient.alloc().initWithSocketURLConfig is not a function. (In 
'SocketIOClient.alloc().initWithSocketURLConfig(NSURL.URLWithString(uri), _options)', 
'SocketIOClient.alloc().initWithSocketURLConfig' is undefined)

Android build fail

Hi, I updated my android sdk tools yesterday to the latest version etc.

This caused my android app to fail during the build process:

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':transformResourcesWithMergeJavaResForF0F1F2F3F4F5Debug'.

com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/maven/com.squareup.okhttp3/okhttp/pom.properties
File1: /Users/user/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.5.0/4b0bb6bfbecbdd42b97ff400af342bfe7f32bc83/okhttp-3.5.0.jar
File2: /Library/WebServer/Documents/demos/background-geo-test/platforms/android/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/10.2.6/jars/classes.jar

I removed the nativescript-socket.io (through debugging etc) and the build passes.

I created a new app and added in your plugin and ran a build which passed. So I think it clashes with the firebase plugin, here is my package.json:

"dependencies": {
"@angular/animations": "~4.0.0",
"@angular/common": "~4.0.0",
"@angular/compiler": "~4.0.0",
"@angular/core": "~4.0.0",
"@angular/forms": "~4.0.0",
"@angular/http": "~4.0.0",
"@angular/platform-browser": "~4.0.0",
"@angular/platform-browser-dynamic": "~4.0.0",
"@angular/router": "~4.0.0",
"angular2-moment": "^1.2.0",
"nativescript-angular": "~1.5.1",
"nativescript-ngx-fonticon": "^2.0.0",
"nativescript-photoviewer": "^1.2.0",
"nativescript-plugin-firebase": "^3.9.3",
"nativescript-socket.io": "^0.5.0",
"nativescript-telerik-ui-pro": "nativescript-ui-pro.tgz",
"nativescript-theme-core": "~1.0.2",
"reflect-metadata": "~0.1.8",
"rxjs": "~5.2.0",
"tns-core-modules": "^2.5.2",
"zone.js": "~0.8.2"
},
"devDependencies": {
"babel-traverse": "6.24.1",
"babel-types": "6.24.1",
"babylon": "6.17.1",
"lazy": "1.0.11",
"nativescript-dev-android-snapshot": "^0..",
"nativescript-dev-sass": "^0.4.2",
"nativescript-dev-typescript": "~0.3.5",
"typescript": "~2.1.0"
}
my tns info:

┌──────────────────┬─────────────────┬────────────────┬──────────────────┐
│ Component │ Current version │ Latest version │ Information │
│ nativescript │ 2.5.5 │ 3.0.1 │ Update available │
│ tns-core-modules │ 2.5.2 │ 3.0.1 │ Update available │
│ tns-android │ 2.5.0 │ 3.0.0 │ Update available │
│ tns-ios │ │ 3.0.1 │ Not installed │

Do you have any thoughts?

Building failed, can't run "npm run ios" in a nativescript folder under seed context (exit code 65)

The seed I'm using, which is the maestro native angular2 seed, works perfectly. However I think the plugin is broken, for some reason.

1 - I added the plugin to the package.json

2 - I updated and installed the plugins in package.json

3 - I ran "npm run ios" and compilation began. Before the plugin everything was working so far.

Here are the relevant logs after npm run ios:

(...)
Using GoogleMaps (2.5.0)
Installing Socket.IO-Client-Swift (12.1.2)
Installing Starscream (2.1.1)
Generating Pods project
Integrating client project
Pod installation complete! There are 2 dependencies from the Podfile and 3 total pods installed.
[WARNING]: [!] Automatically assigning platform ios with version 8.0 on target nativescript because no platform was specified. Please specify a platform for this target in your Podfile. See https://guides.cocoapods.org/syntax/podfile.html#platform.

Errors thrown by CompileSwift:

/Users/air/Desktop/Repos/B13/nativescript/platforms/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngine.swift:228:43: error: value of optional type 'String?' not unwrapped; did you mean to use '!' or '?'?
if let data = Data(base64Encoded: noPrefix, options: .ignoreUnknownCharacters) {

/Users/air/Desktop/Repos/B13/nativescript/platforms/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngine.swift:521:34: error: value of type 'String' has no member 'dropFirst'
handleMessage(String(message.dropFirst()))
^~~~~~~ ~~~~~~~~~
/Users/air/Desktop/Repos/B13/nativescript/platforms/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngine.swift:527:41: error: value of type 'String' has no member 'dropFirst'
handleOpen(openData: String(message.dropFirst()))

/Users/air/Desktop/Repos/B13/nativescript/platforms/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEnginePollable.swift:187:19: error: 'count' is unavailable: there is no universally good answer, see the documentation comment for discussion
guard str.count != 1 else { return }
^~~~~
Swift.String:231:16: note: 'count' has been explicitly marked unavailable here
public var count: Int { get }

Finally:

The following build commands failed:
CompileSwift normal x86_64 /Users/air/Desktop/Repos/B13/nativescript/platforms/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEngine.swift
CompileSwift normal x86_64 /Users/air/Desktop/Repos/B13/nativescript/platforms/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Engine/SocketEnginePollable.swift
CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
(3 failures)
Multiple errors were thrown:
Command xcodebuild failed with exit code 65

Any idea on what might be wrong here? Is the plugin known to be broken?
Thank you

Error in pod install

When I try to build my app with $ tns build ios I get this error:
screen shot 2016-11-22 at 12 40 57 pm

All I did was :
$ tns create test-app --ng
$ tns plugin add nativescript-socket.io
$ tns platform add ios
$ tns build ios

I found that changing the Podfile to
pod 'Socket.IO-Client-Swift', :git => 'https://github.com/socketio/socket.io-client-swift.git'
instead of
pod 'Socket.IO-Client-Swift', '~> 8.1.1'
fix the problem but I'm not sure if this is the best solution.

Error compiling on iOS

Hi,

i have and TNS android project with this plugin that runs perfectly now.

When i try to do TNS EMULATE IOS i have the following error:

[!] Unable to satisfy the following requirements:

- `Socket.IO-Client-Swift (~> 8.1.1)` required by `Podfile`

None of your spec sources contain a spec satisfying the dependency: `Socket.IO-Client-Swift (~>
8.1.1)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.
Processing node_modules failed. Error: Command pod failed with exit code 1

i don't know what this means.... do you have some idea ? Thanks in advance

Use with TNS NG2 - io is not defined

Hi,

i am trying to use this plugin with an NG2 Nativescript app. I used it successfully into another app written in vanilla JS nativescript, but i am not able to use it on NG2;

I've put this into my code

import * as SocketIO from 'nativescript-socket.io';

But whenever i try to use the SocketIO var, the app crashes saying that io is not defined.

Any idea ? Thanks very much in advance

ROADMAP

Android

  • connect
  • connect with options
  • disconnect
  • add event listener without acknowledgement
  • emit event without acknowledgement
  • add event listener with acknowledgement
  • emit event with acknowledgement
  • remove all event listeners
  • remove particular event listener
  • add one-time event listener

iOS

  • connect
  • connect with options
  • disconnect
  • add event listener without acknowledgement
  • emit event without acknowledgement
  • add event listener with acknowledgement
  • emit event with acknowledgement
  • remove all event listeners
  • remove particular event listener
  • add one-time event listener

TODO

Ack on emit

Instead of default function(){}. is the ack in function ack() {} mandatory?

In the examples, there is arguments in ack scope. Where this argument come from?

Does this plugin support transport mode websocket?

According to an article I was reading,
socket.io tries to upgrade to websocket connection, whenever it is available.
I was not able to see any upgrade request going form this plugin..

Does this plugin support websocket transport mode for socket.io ?

not working on iOS

this plugin works well on Android but when I tried to implement it on iOS, it didn't work. No error report on the console but apparently the socket is not connected because I put console.log() inside the on 'connect' callback and nothing prints out. I also put console.log() inside the new message listener and when I send a new message I also get nothing on the console. Anyone else ran into this issue and solved this? I really need help. thanks

IOS `init` is depricated

Hello,

There is sum deprecated on IOS.

Do you know for how many time it will be suproted for the new IOS ?

[18-07-29 20:48:50.004] (CLI) 'init' is deprecated [18-07-29 20:48:50.004] (CLI) return String(substring)! [18-07-29 20:48:50.004] (CLI) ^ [18-07-29 20:48:50.004] (CLI) [xcode-build] /tmp/builds/_/b2850e784066d55f858e7801db7100595729e766/4.1.2/DIGIPAYMERCHANT/platforms/ios/Pods/Socket.IO-Client-Swift/Source/SocketIO/Util/SocketStringReader.swift:67:16

Thank you.

Cannot connect after manual disconnect

First, I want to thank for brilliant plugin, it works as expected. I just have one issue. when app is loaded user is connected to socket.io server and everything works fine, but once user logs out from the app I manually disconnect the socket(so user doesn't get notifications and so on) and redirect user to login page. If user decides to login without refreshing the app, on login user is not connected to socket.io server. Everything works fine once app is closed and opened again. Any help or advised would be highly appreciated. Thanks

Socket disconnects immediately after connect on iOS.

Hello.
I found a bug while playing with nativescript-socket.io, and I can't find a solution.
Every connection event to socket.io server from an iOS device, is followed by an 'disconnect event'. Every time.
It seems I get a Bad Request Error.
On Android devices works fine.
How can I solve this problem? Thanks!

Console is undefined ??

Hello guys I have a problem with my NS app, I have installed nativescript-socket.io
but when I restart my app I always get this error:

Successfully synced application at.myapp.app on device emulator-5554.ActivityManager: Start proc 8184:at.myapp.app/u0a110 for activity at.myapp.app/com.tns.NativeScriptActivitySystem.err: com.tns.NativeScriptException: System.err: Calling js method call failedSystem.err: System.err: ReferenceError: console is not definedSystem.err: File: "file:///data/data/at.myapp.app /files/app/tns_modules/nativescript-socket.io/socketio.common.js, line: 55, column: 4System.err: System.err: StackTrace: System.err: Frame: function:'debugDefault', file:'file:///data/data/at.myapp.app/files/app/tns_modules/nativescript-socket.io/socketio.common.js', line: 55, column: 5System.err: Frame: function:'debug', file:'file:///data/data/at.myapp.app/files/app/tns_modules/nativescript-socket.io/socketio.common.js', line: 64, column: 12System.err: Frame: function:'listener', file:'file:///data/data/at.myapp.app /files/app/tns_modules/nativescript-socket.io/socketio.js', line: 71, column: 31System.err: System.err: at com.tns.Runtime.callJSMethodNative(Native Method)System.err: at com.tns.Runtime.access$2400(Runtime.java:34)System.err: at com.tns.Runtime$3.run(Runtime.java:1099)System.err: at android.os.Handler.handleCallback(Handler.java:751)System.err: at android.os.Handler.dispatchMessage(Handler.java:95)System.err: at android.os.Looper.loop(Looper.java:154)System.err: at android.app.ActivityThread.main(ActivityThread.java:6119)System.err: at java.lang.reflect.Method.invoke(Native Method)System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)05-08 06:10:46.629 8184 8184 E AndroidRuntime: at com.tns.Runtime.callJSMethodNative(Native Method)ActivityManager: Killing 8184:at.myapp.app/u0a110 (adj 900): crashActivityManager: cleanUpApplicationRecord -- 8184 | 01:00 |  
10% | Stütz Christoph | 07.05.2018 | Administration | - | Testing the Android version and reporting the BUG

once function for feathers authentication

Hi,

I use this library together with featherjs.
The feathers authentication over sockets makes use of the once function available in socket.io-client.
The code from there is quite simple, it replaces the handler with a wrapper, that when called executes the callback and removes itself from the event:

Emitter.prototype.once = function(event, fn){
	  function on() {
	    this.off(event, on);
	    fn.apply(this, arguments);
	  }
	  on.fn = fn;
	  this.on(event, on);
	  return this;
	};

I tried to add this function in my code, but my javacript skills are not so well, so I ended up with this:

        this.socket.once = (event, fn) => {
            let on = (args) => {
                this.socket.off(event);
                fn(args);
            }
            this.socket.on(event, on);
        };

This instead of just removing the one handler from the event removes every handler for the event. I didn't manage to get it work the other way. However, featherjs authentication works now for me.

I think it would be great to add once to this library, so feathersjs would work out of the box. I guess it should be easy to add for someone who knows this lib.

Cheers,
Timo

Build Failed

NativeScript Version: 2.3.0
XCode Version 7.3.1 (7D1014)

The following build commands failed:
	CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler
	CompileSwift normal x86_64 /Users/eurica/Documents/Apps/social-garage/platforms/ios/Pods/Socket.IO-Client-Swift/Source/SocketAckEmitter.swift
	CompileSwift normal x86_64 /Users/eurica/Documents/Apps/social-garage/platforms/ios/Pods/Socket.IO-Client-Swift/Source/SocketAckManager.swift
	CompileSwift normal x86_64 /Users/eurica/Documents/Apps/social-garage/platforms/ios/Pods/Socket.IO-Client-Swift/Source/SocketAnyEvent.swift
	CompileSwift normal x86_64 /Users/eurica/Documents/Apps/social-garage/platforms/ios/Pods/Socket.IO-Client-Swift/Source/SocketClientManager.swift
(5 failures)
Command xcodebuild failed with exit code 65

Plugin is not compatible with xcode 10.2

Hi,
Thanks for your great plugin.
I noticed after I update my xcode today that the build is not complete and get these errors in cli:

Xcode build...
error: SWIFT_VERSION '3.1' is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target 'Socket.IO-Client-Swift')
error: SWIFT_VERSION '3.1' is unsupported, supported versions are: 4.0, 4.2, 5.0. (in target 'Socket.IO-Client-Swift')
note: Using new build systemnote: Planning buildnote: Constructing build description
** BUILD FAILED **

any help to build the app ?

iOS Build Fail

Hi,

I created a fresh NG app and then added this plugin.

I ran pod repo update to update an pod files.

I tried building it for iOS using tns build ios and I get this error:

=== BUILD TARGET StarscreamSocketIO OF PROJECT Pods WITH CONFIGURATION Debug ===
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

I get this error before or after the pod update.

I am using the latest CLI / TNS versions and latest version of the plugin.

I am using xCode 8.2.1 on El Capitan.

Anyway to fix this?

AOT compilation fail

AOT compilation with uglify, npm run build-android-bundle --uglify.

ERROR in 0.js from UglifyJs
Unexpected token: name (SocketBase) [0.js:5094,6]

ERROR in 1.js from UglifyJs
Unexpected token: name (SocketBase) [1.js:4953,6]

ERROR in 2.js from UglifyJs
Unexpected token: name (SocketBase) [2.js:5076,6]

ERROR in 3.js from UglifyJs
Unexpected token: name (SocketBase) [3.js:4967,6]

ERROR in bundle.js from UglifyJs
Unexpected token: name (SocketBase) [bundle.js:10902,6]

tns version 3.1.2

package.json
node 7.10.1
npm 4.2.0

"dependencies": {
    "@angular/animations": "~4.1.3",
    "@angular/common": "~4.1.3",
    "@angular/compiler": "~4.1.3",
    "@angular/core": "~4.1.3",
    "@angular/forms": "~4.1.3",
    "@angular/http": "~4.1.3",
    "@angular/platform-browser": "~4.1.3",
    "@angular/router": "~4.1.3",
    "nativescript-angular": "~3.1.2",
    "nativescript-camera": "~3.0.1",
    "nativescript-fresco": "~3.0.4",
    "nativescript-geolocation": "~3.0.0",
    "nativescript-google-maps-sdk": "~2.3.2",
    "nativescript-imagepicker": "~3.0.2",
    "nativescript-iqkeyboardmanager": "~1.1.0",
    "nativescript-push-notifications": "~0.1.4",
    "nativescript-socket.io": "~0.6.0",
    "nativescript-telerik-ui-pro": "^3.0.1",
    "nativescript-theme-core": "~1.0.4",
    "reflect-metadata": "^0.1.10",
    "rxjs": "~5.4.2",
    "tns-core-modules": "^3.1.0",
    "zone.js": "~0.8.12"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~4.1.3",
    "@ngtools/webpack": "~1.4.2",
    "babel-traverse": "6.24.1",
    "babel-types": "6.24.1",
    "babylon": "6.17.0",
    "codelyzer": "^3.0.1",
    "copy-webpack-plugin": "~4.0.1",
    "extract-text-webpack-plugin": "~2.1.0",
    "fs-extra": "^0.30.0",
    "glob": "^7.1.2",
    "lazy": "1.0.11",
    "markdown-snippet-injector": "^0.2.0",
    "nativescript-css-loader": "~0.26.1",
    "nativescript-dev-typescript": "^0.5.0",
    "nativescript-dev-webpack": "~0.7.3",
    "opener": "^1.4.1",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.0.2",
    "rimraf": "^2.5.3",
    "tar.gz": "^1.0.5",
    "tns-platform-declarations": "^3.1.0",
    "tslint": "^5.4.2",
    "typescript": "~2.3.4",
    "webpack": "~2.6.1",
    "webpack-bundle-analyzer": "^2.8.2",
    "webpack-sources": "~1.0.1"
  }

need upgrade to {N} V4 ?

Hi, I'm trying to use this plugin in my app that use {N} v4, but it does not work with me.
When I'm trying to connect to the server I got this error:

CONSOLE LOG file:///app/tns_modules/nativescript-socket.io/socketio.common.js:55:22: nativescript-socket.io on error ["Transport unknown"]

I don't know the reason but I suspect the reason from the version.
Any help please ?

iOS Swift 4.0 Build Failed

Am using XCode 10.1 with Swift 4.0
and required to use nativescript-algolia which must work under Swift 4.0

pod 'AlgoliaSearch-Client-Swift', '~> 5.0'

post_install do |installer|
    installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['SWIFT_VERSION'] = '4.0'
      end
    end
end

May I ask is it currently supporting Swift 4.0 or above ? Thank you!

One connection through multiple pages

Hi,

Thank you for nice plugin. I followed demo and tried to implement one connection through multiple pages but every time I require socket instance it connect as a new socket. How to solve this issue? Any help would be highly appreciated. Thanks

Object.hashCode() on a null object reference

Hi @naderio, I have implemented this library within the SDK Builder and it is working great, except that sometimes we get an error when using the off() method.

Not sure why, it does not do all of the times but sometimes we get the following breaking the app

JS: EXCEPTION: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
JS:     java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:942)
JS:     java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:933)
JS:     io.socket.emitter.Emitter.off(Emitter.java:70)
JS:     com.tns.Runtime.callJSMethodNative(Native Method)
JS:     com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1022)
JS:     com.tns.Runtime.callJSMethodImpl(Runtime.java:907)
JS:     com.tns.Runtime.callJSMethod(Runtime.java:895)
JS:     com.tns.Runtime.callJSMethod(Runtime.java:879)
JS:     com.tns.Runtime.callJSMethod(Runtime.java:871)
JS:     com.tns.gen.java.lang.Runnable.run(java.lang.Runnable.java)
JS:     android.os.Handler.handleCallback(Handler.java:739)
JS:     android.os.Handler.dispatchMessage(Handler.java:95)
JS:     android.os.Looper.loop(Looper.java:158)
JS:     android.app.ActivityThread.main(ActivityThread.java:7229)
JS:     java.lang.reflect.Method.invoke(Native Method)
JS:     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
JS:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

At that point I'm using plain this.socket.off()to remove all listeners, so I'm not passing an event name in there.

I know this may be a native error I just want to confirm with you if there is something I need to do, for instance always pass a event name? not sure.

Thoughts?

match socket.io-client API

refer https://github.com/socketio/socket.io-client/blob/master/docs/API.md and https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/socket.io-client/index.d.ts for reference

to do:

  • constructor options
  • add addEventListener( event: string, fn: Function ) : this; alias to on()
  • add removeListener( event: string, fn?: Function ) : this; alias to off()
  • add removeEventListener( event: string, fn?: Function ) : this; alias to off()
  • add removeAllListeners() : this;
  • add listeners( event: string ) : Function[];
  • add hasListeners( event: string ) : boolean;
  • add open() alias to connect()
  • add close() alias to disconnect()
  • add readonly disconnected: boolean; inverse of connected

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.