GitXplorerGitXplorer
j

android-websocket-client

public
6 stars
3 forks
0 issues

Commits

List of commits on branch ktor.
Unverified
23216e8a04c0b090584c6e1284f6419e1d2c0904

Handle errors more gracefully

jjamesonwilliams committed 4 years ago
Unverified
40ac5279bb830566db892dd2d12ba67e98e8c4bf

Update README

jjamesonwilliams committed 4 years ago
Unverified
83c1f81014d1d5d6693a7af084913102baac864c

Re-implement WebSocket logic with Ktor

jjamesonwilliams committed 4 years ago
Unverified
26a067421681e18c32d5eb4940ae59bcfc59b7ef

Add instructions

jjamesonwilliams committed 4 years ago
Unverified
2fb79c5a9a35edde5b8f5fadd30376b935c2fb87

Simple app to send and receive messages on a WebSocket

jjamesonwilliams committed 4 years ago

README

The README file for this repository.

Kotlin, Ktor, OkHttp, Android, WebSockets

Simple WebSocket App

Amazon API Gateway added support for WebSockets in December, 2018. The original launch announcement includes a demo app that relays messages between clients.

This Android app provides the ability to read and write messages to that WebSocket endpoint, hosted in Amazon API Gateway.

To use it:

  1. Deploy the Simple WebSockets Chat App.
  2. Copy the WSS URL that is created above. It should look something like wss://YOUR_APP_ID.execute-api.YOUR_REGION.amazonaws.com/YOUR_STAGE. Set it as the value of websocket_url in app/src/main/res/values/strings.xml.
  3. Import this Project into Android Studio
  4. Build and Deploy

Try sending a message to API Gateway with wscat:

wscat -c <your_url>
{"action": "sendmessage", "data": "Hello from the other side."}

Check what happens on the app. You should see the message there.

You can click the "send message" button in the app to send a message the listener, too.

OkHttp & Ktor

Two version of the app are provided:

  1. One using Ktor, and
  2. One using OkHttp