How to implement XMPP communication in Nativescript? - xmpp

Is there any limitation in using a library like stanza.io for communication with an XMPP server like MongooseIM in Nativescript? What other alternatives are there?

If stanza.io supports NativeScript then there should not be any limitations.
On their GitHub main pager they say it's a Modern XMPP in the browser, with a JSON API. So it's mainly for browser env and I'm not sure about NativeScript.
As an alternative way - there is a xmpp.js lib which supports NativeScript. Their doc is a little bit shitty, but using src code there is a way to integrate successfully it.
There is a guide on how to use it for ReactNative, but you can some part from it for NativeScript, especially these part that are connected to the lib itself.
https://medium.com/#connectycube/xmpp-real-time-chat-in-react-native-8d6d5d23dd47
Also you can use some ready XMPP high level platforms for Chat, e.g. https://connectycube.com/2018/12/11/connectycube-textchat-code-sample-for-nativescript/
In this case you do not need to carte about XMPP server installation and monitoring

You will have to find a third party server or host your own one that implements XMPP protocols and connect to same using Websockets or XMPP plugin from your {N} application.
FYI, This XMPP plugin implements the same pod library explained in the MongooseIM docs, but the JavaScript apis are not fully implemented so you might have to access the native apis directly as needed.
You may also refer nativescript-xmpp-client, another exampel for XMPP implementation.

Related

XMPP chat infrastructure recommendations

There is a chat project I plan to develop and currently stuck while deciding, which XMPP server and client to use.
Front-end will be implemented using Ionic 3+ framework (fixed requirement).
Main features:
private chat capability (1 on 1)
group chat capability (and ability to add users to existing chat)
online status visibility
offline message delivery (online user sends a message to offline user, and the offline user gets it after going online, etc)
full-time server-side chat history storage
I need to select:
a client library which is convenient to implement with Ionic 3+
a server which enables all the above requirements
Also, the chat messages should cross the network with at least some kind of encryption.
Currently, I have been playing with these server options:
eJabberd - most people recommend this option, but for me, a person, who is newbie at XMPP stuff, it looks like there will be quite a lot of hassle with configuration
openFire - easy to setup and use, but it uses Java VM, and some people argue, that it has problems with performance and memory management.
I also stumbled upon AstraChat - a commercial product, that looks similar to what I need - however, with fixed implementation of it's own public apps - no way to use it's code base.
As of front-end - I have only tried running the Ionic 1 tutorial locally using Strophe.js as the client in the front-end. Since I am developing the app with Ionic 3+ (TypeSript), it would be awesome to use some newer and TS compatible library - however, it is just a wish, not a requirement. :)
Maybe there are some better and more convenient non-XMPP implementations for this concept. Any thoughts are welcome!
eJabbered is very complex decision for your application.
openFire is also very complex and requires JVM
For your apllication I advise Prosody. It is simple and lightweight desicion.
https://en.wikipedia.org/wiki/Comparison_of_XMPP_server_software
But please think twice about using chat on XMPP protocol. This protocol is very difficult to learn and it has a variety of extensions(e. g. XEP) and you will be confused about documentation.
Alternative https://github.com/actorapp/actor-platform
but documentation is obsolete.

Update dynamic content in Browser plugin

I have a requirement to create a browser plugin. It should be a cross-browser plugin. The look and feel is similar to, say, Ask toolbar. My browser plugin should be able to make calls (using Cisco call control). Internally we will handle that no issue in that. But what is required is that previously we developed website for handling calls, which used java applets to dynamically change the status {Example when there is an incoming call Answer button would get enabled}. Will I be able to achieve it in Browser plugin.
Can I be able to use browser plugin over applet?
Is there any replacement for Java applet in the browser plugin?
Please help me in making a dynamic browser plugin.
Update:
I am planning to go for Kango cross-browser extension Framework. I need to know if Kango or any other extension framework support a socket communication where it can listern for sever update.
Thanks.
Can I use WebSocket (supported in HTML5) in the browser Extension? I learned that WebSocket method could not communicate directly with ordinary server and it need some changes in the server as well.
Ref: Connect to standard socket using WebSocket
Is there any other way other than WebSocket ?
Is there any open source available for javascript library which uses flash player?
If it could be opensource it could be helpful.
Cross browser plugin can be developed using some extension development tools such as Cross Rider or kango . I feel that Cross rider provides good support.
If we are going for Java applet for socket communication, definitely we are ready to face some trouble. Better avoid Java applet.
Socket communication can be achieved in the Web browser using many ways. "Web Socket" is one of them. The only constrain in using it is that it is supported only in HTML5 supporting browser or browser version. IE give support to WebSocket from IE11 only.
Another way to go is using Socket.io . It is having a good way of achieving it by using the available techniques in the client browser. For Example, if the client browser do not have a Flash player (Flash supports socket communication), it uses WebSocket or it "fallback" to available technique supported in browser.
Even node.js is a light weight technique.
The challenge here is we could not communicate with server which support socket with a "websocket" client. We need a proxy, Ref: Connect to standard socket using WebSocket
Hope this should help who need some start on Web Socket communication. If anyone want to add to this I would be very happy.

Building an Openfire XMPP External Component - use Tinder or Whack?

I'm trying to build an external component for the Openfire XMPP server, but I'm a bit confused between Tinder and Whack. Tinder seems to be the newer library and has the AbstractComponent interface which Ignite Realtime are recommending over the standard Component, however, whenever anyone talks about building an external component, they seem to be using the Whack library.
Should I be using Tinder or Whack? Or a bit of both?
Many thanks
Tinder utilises the Whack library and wraps the component in an abstract component interface so you don't have to implement all the methods for handling all types of packets if you don't need to.
Have a look at the source for the weather example.
It's also worth looking at the whack source to see how it handles the packets as this is what is ultimately connecting to your server and sending packets.
Personally I use the externalcomponent manager from whack and setup an abstract component using tinder which is exactly what the weatherabstract example does.
That's the best place to start.

How to create a simple browser-based IRC client?

I want to implement a chat service on my site, and wonder how to create a simple browser-based IRC client from scratch?
I have a linux box and can install whatever I want on it. Google finds tutors on how to setup an IRC server but no instructions on how to create an IRC client.
(As client languages, I can use JavaScript or Flash.)
As you are already familiar with JavaScript, I would recommend a combination of Node.js, Now.js and node-irc.
Node.js is an application that enables you to run JavaScript server-side and to develop web-applications very fast.
Now.js is a library for Node.js that enables you to RPC between client and server. You can just call a function on the server from your client application and vice-versa; their developers guide is in fact a web chat ;)
node-irc is also a library for node.js that enables you to easily create an IRC client.
Combine these three and you get a very nice, very easy self-coded web chat. For the browser interface, there are many possibilities, including application frameworks like ExtJS, JQueryUI, KendoUI or something easier.
http://www.lightirc.com/
http://wdmedia.org/WFIC/index-en.html#sectiondescription

differences between smack, tinder and whack

Can anyone tell me what the differences are between smack, tinder and whack?
Are tinder and whack slim-down versions of smack? Do the 3 libraries serve different purposes?
Smack is a client library. You can use it to log into an XMPP domain and make use of the functionality it provides. Typically, Smack is used to implement a instant messaging client.
Tinder is a low-level XMPP library. It provides Java implementations of basic XMPP entities, such as Stanzas (called 'Packet' in XMPP), JIDs and Components (which typically implement part of the functionality of an XMPP server). Although in theory, Tinder could be used to implement client functionality, it currently is primarily used on the server-side. Both Whack and Openfire (an XMPP server implementation) use Tinder-defined entities. Smack does not use Tinder at all.
Whack is Java library that is used to implement external components. Whack allows a Component (as defined in Tinder) to run as a stand-alone process. Whack allows you to connect this process to an XMPP domain. This way, you can extend the functionality provided by that domain without modifying the implementation of the server software.
I suggest reading this Blog entry
Introducing Tinder, an XMPP object implementation library
Smack -> Cross-platform real-time collaboration client optimized for business and organizations
Whack -> Java XMPP component library
Tinder -> Java based XMPP library, providing an implementation for XMPP stanzas and components
Tinder builds on code from Openfire and Whack. Does not replace Smack but will most likley replace Whack, OpenFire (formerly WildFire)
If you wanna create an application:
Smack will be client side Library
Whack and/or Tinder will be Server side Library