Skip to main content

Chat Application

This guide will go over step by step of setting up an application using the python implementation of RSocket.

tip

If you find a problem, code or otherwise, please report an issue

Preface

We will be setting up a chat application with a server and a client.

The chat client will have the following functionality:

  • Private messages between users
  • Joining and sending messages to channels
  • Uploading/Downloading files
  • Getting server and client statistics (e.g. number of channels)

Since the emphasis is on showcasing as much RSocket functionality as possible, some of the examples may be either a bit contrived, or be possible to implement in a different way using RSocket. This is left as an exercise to the reader.

In the first steps the code will be written using only the core code. This results in more verbose code, but prevents the need for additional packages need be installed. In later steps, Reactivex implementation will be added to show more concise code, on both server and client side.

Required knowledge

The guide assumes the following knowledge:

  • Basic python level (Classes, methods, decorators, dataclasses)
  • Basic asyncio usage
  • Basic understanding of RSocket protocol (See About RSocket)

Required setup

Install the rsocket package. See the pypi package listing for installation methods. The tutorial was tested against version 0.4.5.

Code

The tutorial code is available on GitHub under examples/tutorial.