Smartface.io MQTT plugin - smartface.io

I need to use a mqtt client in smartface.io and was wondering if someone has developed a plugin or can advice how to do it. Actually the broker does not support websockets
Thanks

There is no support in SmartFace for MQTT so you need to implement this yourself.
A good option for beginners might be another product like: B4A https://www.b4x.com/b4a.html .. where the community have already created a lot of libraries/resources.
https://www.b4x.com/android/forum/threads/jmqtt-official-android-mqtt-client.59497/

Related

How to implement XMPP communication in Nativescript?

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.

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.

How to create an API REST?

I want to reach the data saved in a mysql server for an Android phone. I thought about to connect directly the phone to the mysql but it is a bad practice because someone can get the user/pass of the DB.
However the REST architecture maybe it's a solution for my problem. I found the toolkit GWT but I don't know if it's the best way to solve my problem and what I need to use the GWT.
And I got 2 questions basically:
The GWT is good for my purpose?
Need a Tomcat server for example to set the GWT code?
One annotation, the data is for an app Android, there is no HTML interface .
Nowadays I'm working at localhost. Thanks for the answers.
As far as I understand, you want to implement a RESTful service (Web API). GWT targets the Web UI to be able to build it using Java and compile it into JavaScript. I think that it's not what you expect.
Here is a link that provides you hints about concepts of REST: https://templth.wordpress.com/2014/12/15/designing-a-web-api/. It will describe you what is a RESTful service and how to design it.
There are several technologies to build RESTful services (server-side frameworks). I can list two of them:
Restlet (see this link http://restlet.com/technical-resources/restlet-framework/tutorials/2.3 and http://restlet.com/products/restlet-framework/)
JAX-RS and its implementations (Restlet, Jersey, EasyRest). See this link for example: https://templth.wordpress.com/2015/03/06/getting-started-with-resteasy/.
Hope it helps you,
Thierry

What is Cometd ? Why it is used and how to work on that

i'm just a beginner in cometd , and i'm interested and wanted to learn what cometd is and what for it is used i googled it out and found some resource.Under the following link
1.http://docs.cometd.org/reference/installation.html#d0e346.
I tried out with the given demo but i could not able to get the expected output from it. can anybody post some resource url's so that i can learn ?
Disclaimer: I'm the CometD project leader.
CometD is a set of library to write web applications that perform messaging over the web.
Whenever you need to write applications where clients need to react to server-side events, then CometD is a very good choice. Think chat applications, online games, monitoring consoles, collaboration tools, stock trading, etc.
See more at the preface.
CometD ships a JavaScript client library, a Java client library and a Java server library.
This allows you to write applications in the browser with fine-grained logic and control on the server.
The server library, being in Java, leverages the high scalability of the JVM and the powerful asynchronous I/O API that the JVM and the Servlet specification provide.
CometD is transport agnostic: you write your applications using high level APIs, and CometD takes care of delivering the messages over the wire using the best transport available: WebSocket or HTTP, also providing a transparent fallback in case WebSocket does not work.
CometD provides a clustering solution called Oort that allows you to scale horizontally your web applications.
CometD comes with a ton of features and an extended documentation along with tutorials and demos you can use as a starting point for your project.
Join CometD to start hacking on your CometD-based web applications.
The CometD tutorials are currently written for CometD 2.x, but a port to CometD 3.x (the current version of CometD) is currently underway, so that requires a bit of patience.
But you can start right away by following the primer and deploying the demos.
I hope you can get started with CometD with the above references.
Drop an email on the mailing lists for any help you may need.

Is there any iOS implementation of the Bayeux protocol (COMET, server push to client)?

Is there any library with implementation of the Bayeux protocol, for use in iOS (iPhone/iPad) development, for the building Server push technology iPhone client?
And what are your suggestion for doing this?
Even though I haven't tried it, I would check FayeObjC:
"A simple Objective-C client library for the Faye publish-subscribe messaging server. FayeObjC is implementing on top of the zimt Objective-C web socket library and will work on both Mac and iPhone projects. JSON parsing is handled using the excellent JSONKit (github.com/johnezang/JSONKit) library which is included in the FayeObjC source folder."
For more info:
http://blog.cometcoast.com/post/3668374972/fayeobjc-an-objective-c-faye-client-for-ios-mac-os
Sources:
https://github.com/pcrawfor/FayeObjC
I know that this question is fairly old, but I googled and found it. Maybe this answer can help someone else:
Take a look at ddunkin cometclient library: https://github.com/ddunkin/cometclient
I haven't tested but will try it with my next project.
I suggest you to use my reimplementation FayeClient with many additional stuff like blocks and error handling MZFayeClient
I've created a fork of the DDunkin Comet client that supports ARC and client based subscription management which helps with resubscribing on disconnects. I also added a lot of block support and delegate call backs.
https://github.com/yinzara/cometclient