Custom protocol on top of ktor that is not HTTP or websockets with native support? - ktor

I am writing a server/client application with its own custom protocol. It is asynchronous which fits with Kotlin and Ktor.
I wonder how I can use Ktor to implement my own protocol on top on ktor-server-cio engine with full support for kotlin/Native.
Where could I find documentation or examples, I can't find it in the documentation, also it is hard to see what is and is not dependent of kotlin/JVM?
Thankyou in advance.

The CIO engine for a server doesn't support Kotlin/Native yet.
You can use sockets API from the ktor-network module, which does support Kotlin/Native, to implement client and server for your custom protocol on top of TCP or UDP.
As an example, take a look at rsocket-kotlin library where transports are implemented based on Ktor.

Related

FCM http v1 API integration for servers using programming languages including c++ that does not have SDK supports

We're considering to migrate legacy API to FCM HTTP v1 API to fully utilize FCM functionalities.
Although they provide API Client Library for various programming languages, it could not be possible to cover all programming languages including C++.
Because our push server is written in C++, we decided to implement the protocols. However, we could not find any documents on how to get access token using service-account.json file or server key that can be found in firebase console.
Is there anyone who integrated FCM HTTP v1 API without SDKs that FCM provides?
I figured out the problem.
These articles helped me to implement the protocol in C++. Now it works well. developers.google.com/identity/protocols/oauth2 developers.google.com/identity/protocols/oauth2/service-account

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.

Does api work like bytcode to provide multi-platform functionality

I've recently come across the term api and from what I have known api is a interface that connects/integrates between two programs and it can run on any platform.
And again from java we know that it turns it's source code into bytecodes and this bytecode can run on any platforms since it is platform independent.
So my question is does api work/run just like as a bytecode to provide multi-platform functionality
And if not is there any similarities between them or thier process? If please anyone could explain it to me it would be a great help. Thanks in advance.
API does not work like bytecode
Actually, API and Bytecodes are a completely different thing
For Bytecode,
let's try to understand it in java. java compiler compiles a java program then produce bytecode. Then the bytecode is interpreted by java interpreter in different machines and generate different executable files as the requirement of different machines and os.
this is how java maintains it's multi-platform property
Now, API,
API stands for Application Programming Interface. An API is a software intermediary that allows two applications to talk to each other. In other words, an API is the messenger that delivers your request to the provider that you’re requesting it from and then delivers the response back to you.
there are many types of API's out there
but I think you are referring to Web API and it's multi-platform functionality and how it works.
A Web API is an application programming interface for either a web server or a web browser
A Web API works as server-client architecture.
client request to server through HTTP protocol, server responds to client through HTTP protocol
actually whole api service is provided through HTTP protocol, and this api service can provide to any device using HTTP protocol
this has nothing to do with bytecode

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.

How to implement WCF test client for non windows platform.

I have been evaluating and working on a prototype where I have exposed couple of API using WCF web service. My service is working as expected with managed client in windows platform. My service client can be on any platform. I dont know how to approach for other platform (UNIX). Couple of options I have considered so far -
GSOAP
MONO dotnet
I could not use any one of these due to some constraints. Now the only option I left out to implement my own client which can send soap request and get soap response. My preferred technology is C/C++. I am using wsHttpBinding in my server and will be working on http protocol only.
I am not sure about the following points-
Do I need to implement my own WSDL parser?
Do I need my own serializer?
How could I make my client more flexible so that any changes in my WSDL make minimal code changes on client side?
I am looking for help from the experts who could guide me with a proper approach with a basic client sample.
My experience is in WCF interoperability with Java clients. You can use Java SOAP libraries like metro http://metro.java.net/ or axis http://axis.apache.org/axis2/java/core/index.html . There is even a C library for axis. http://axis.apache.org/axis2/c/core/
I am sure other languages like Ruby/Python etc has similar libraries as well.
The other option is to use a REST based interface and then you can use any language/platform that has HTTP support or even a tool like curl and libcurl http://curl.haxx.se/.