React native paho mqtt using tcp not webSocket - react-native

Is there any way to use TCP instead of websocket in react native paho mqtt?

As #hardillb says, react-native-paho-mqtt only supports WebSocket because React Native itself doesn't support raw TCP out of the box. That said if you could write a wrapper to wrap https://github.com/PeelTechnologies/react-native-tcp in an API that looks like a WebSocket, you could pass your wrapper to react-native-paho-mqtt like this - theoretically that'd work, albeit a bit messily.

The Paho JavaScript client only supports MQTT over WebSockets because it is intended to be used in the browser.
You could look at the mqtt package (https://www.npmjs.com/package/mqtt) on npm which can be used natively or in the browser and is capable of both MQTT over Websockets and native MQTT, assuming the underlying JavaScript sandbox will allow full TCP sockets.

Related

Websocket client in Kotlin

I was wondering why there is no Websocket client native object in Kotlin like it is in javascript.
How does one connect to a Websocket server in kotlin as I created a Node.js websocket server and want to connect to it using an Android client.
Can someone please elaborate on this.
Thanks.
There is. If your question is about Kotlin native/multiplatform, you can use ktor client:
https://ktor.io/clients/websockets.html.
On the Android side, you would need to use CIO or OKHttp engines. On the javascript side, Js engine. On the iOS side, there is currently no support available out of the box, but it's supposed to be coming soon.
If your question is not about Kotlin native/multiplaform, you can still use the above or org.java_websocket.client.WebSocketClient, or any of the third party libs.

MQTT vs MQTT over websocket in react native

I am a little bit confused about what extra functionality MQTT over WebSocket provides vs traditional MQTT over TCP in react native. Is MQTT over WebSocket a solution for browsers in order to receive an event in real-time or it adds something more that I can't catch?
MQTT over Websockets provides 2 main capabilities over native MQTT.
Allows browser based systems to connect to brokers and publish/subscribe to messages. This is because the browser's sandbox doesn't allow native socket operations.
Allows MQTT applications to make use of existing proxy set ups. MQTT over Websocket connections can be made through HTTP proxies in situations where other traffic is blocked by a local firewal.

Does JS paho client has limited features compared to java client?

In browser side i am using paho client and server is Activemq. What i found is that paho JS client has very limited set of features but java client has lots of feature.
Some feature that i want is Message delivery confirmation, message time etc. how can i get all these kind of feature in browser side client or what should be a common architecture of MQTT chat applictaion for these features. Shall i do separate Java api call for getting these kind of features ?
Both the Java and the Javascript both have callbacks for onMessageDelivered
And MQTT has no fields for a timestamp, so I'm not sure where you've seen Message Time

Signalling channel for WebRTC

I want to create my own video chat application. I use the WebRTC framework. I read a few tutorials and each of theme assumes that signalling channel exists. How to implement my own signalling channel?
Since signalling is not defined for the WebRTC standard at the moment, it leaves you a few options. Check out this article for more info the following articles:
Signalling Options for WebRTC Applications
Choosing your signalling protocol
1.SIP over WebSockets
Companies like JSSIP offer a SIP signalling framework over Javascript. The advantage here is that it's interoperable with the usual VoIP structures.
JSSIP
SIPJS
SIPML5
2.The WebRTC Data Channel
Uncharted territory but viable!
Tutorial by Pusher
3.XMPP
If you take this route, it is probably either because you have an existing XMPP installation
Jingle
4.JSON over COMET or WebSockets
My favourite! WebRTC signalling shouldn't be done any other way than the Web way.
Matrix
Firebase
I hope this helps!
You can make a Node.js WebSocket server or other WebSocket server to broker the connection. Here is a simple guide that gets the first client talking to the server. An alternative is PeerJS, which can handle the signaling and alleviate most of the complexity of setting up the WebRTC call.
With serverless options available, vanilla HTTP AJAX options may not be bad for scalability and costs.
Create a plain HTTP(s) API exchanging information using JSON.

Other than MtGox, what APIs are out there, which implement WebSockets as their transport mechanism?

I am looking to start working with some WebSockets and would like to create a few examples using some existing WebSocket APIs out there.
Do you know of any other ones that are nice other than MtGox's streaming API for Bitcoin?
Have you checked out the websockets api prototype at html5 labs?
DataSift have a WebSocket API:
http://support.datasift.com/help/kb/rest-api/websocket-streaming