Can we integrate kafka with react native

Viewed 1843

How to integrate kafka with react native for chat and real time tracking of a client.

and is it possible to implement or i want to use socket io for it give me a solution

1 Answers

A quick solution would be to put the Kafka cluster behind a simple REST API. Using a library like kafka-rest could be an easy way to connect your React Native app using the built in fetch function. You could go a step further and try to integrate the kafka-rest-node client into your React Native app; a cursory overview of the repo doesn't lead to any core Node dependencies.

Another method, one which would allow for "live" updates, might consist of putting Kafka behind a web server that converts the Kafka stream into a WebSocket connection. Libraries such as kafka-websocket allow clients to both consume and produce, whereas a more simple library like Microsoft's kafka-proxy-ws only allows for consuming messages.

It's worth noting that mobile clients don't always work well with streaming data, and you'd be advised to test your WebSocket-based implementation on a variety of uncertain network conditions (latency, dropped signals, etc).

Related