Anyone out there with a complete example on how to use socket.io with Ionic 2?
I found a version for ionic 1 here, but nothing comparable for version 2.
there’s already questions asked about ionic 2 and socket.io you should search down the forum before posting anything about that.
@skoff How do you know that I did not do this? I find your answer disappointing. Let me tell you, why:
https://forum.ionicframework.com/search?q=ionic%202%20socket.io%20 yields the following results
-
Socket.io Ionic – outdated:
- uses --ambient cl argument
- no full example that works (my problem: typings for socket.io-client seem not to work currently, maybe because I misunderstood something)
- The example pointed to at https://www.thepolyglotdeveloper.com/2016/01/creating-a-real-time-chat-application-with-ionic-2-and-socket-io/ is outdated and uses JavaScript insated of Typescript
- How to use socket.io in ionic 2 – recommends to use strongly deprecated addition to index.html
-
Import socket.io-client not working points to what I think will be the correct path, namely to use
typings install dt~socket.io-client --save --global
, but ALAS, no working example how to continue - Using socket-io with Ionic2 deals with a side topic wrt security, not my question
- Downloading Ionic Alpha CLI Issues has nothing to do with the question I have
- Best way to make a chat app? indirectly points to http://melvin0008.github.io/blog/ionic-socketio-chat/ which I believe is not the recommended way to set up an Ionic 2 app
- ngFor Not Updating talks about using zones directly which I already learned should not be necessary now
- [DEMO] Ionic chat app points to https://codecanyon.net/item/whats-app-chat-clone-an-ionic-framework-socketio-and-nodejs-full-hybrid-app-/15859231 which requires you to pay $20 for not knowing if the answer is useful. I already invested $100 into people promising me to explain ionic 2, but left me with outdated crap and now I refrain to spend more money. I currently only recommend this book
- Unrelated: this, this, this, this, this and this
- [DEMO] Ionic chat app points to https://github.com/matiastucci/socket-chat-client which uses javascript, not typescript
- IONIC Not receiving Socket data Javascript, not TypeScript
Then you see the end of the list and the statement:
No more results found.
Maybe I overlooked the needle in the haystack. I spent 4 hours yesterday searching Google with no success for a working example.
I just started with javascript, ECMA 6, TypeScript, Angular 2 and Ionic 2 and though I am an experienced C++ and C# programmer I am having a hard time to grok this way of doing things. Maybe one day we are all back to this programming language.
In the meantime I kindly ask again:
Could you or someone else please post a working Ionic 2 TypeScript demo for using socket.io? It should use components, of course …
i’m sorry but when I search for Socket.IO in ionic 2 category of this forum I can find this post:
From what I can see they managed to make it work.
Yes, I had answered a question just like the OP’s in that thread, where I shared a fully working example of socket.io in ionic2 and typescript.
Here’s the link to the example: http://github.com/beetz12/ionic2-web-chat
Many, many thanks. I still wonder why I did not obtain that search result.