Full Version: Apple Client
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
would anyone be able to share their knowledge of connecting an app to the rpi as a client? I would like to build an app that displays Engine data but am unable to connect to the rpi server. I am using the signal k script for apple since javascript into the Android base code is not clear to me. The code provided by signal K for apple client was used and cocoa pods were installed correctly shown on the following link.

host used is: "10-1-1-40.local"
port used is: 3000

why would the error code: "Request timed out" keep appearing? Running into my browser opens up signalk. Also, is there better instruction for running a client to retrieve data in an Android app then is provided by SignalK website?

The error message sounds like you are trying to reach some other server than what you think.

The server’s api is just http and WebSocket, can’t you just google these and the programming language you are using? Java, Kotlin, Swift, ObjC? To get data by http or stream via ws should be very easy in any language. The advantage of a dedicated client library comes with more complicated stuff, for example access requests and authorization in general.

Sent from my iPhone using Tapatalk
For future reference, this code has got me a response from the raspberry pi. It still needs refinement:

implementation ""

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

Main Activity:

private WebSocketClient mWebSocketClient;

static String TAG = "***WEBSOCKET TEST***";
private static final String SERVER = "ws://";
private static final int TIMEOUT = 5000;

private void connectWebsocket() {
   URI uri;
   try {
       uri = new URI(SERVER);
       Log.d(TAG, "URI COMPLETE");
   } catch (URISyntaxException e) {
       Log.d(TAG, "URI SYNTAX EXCEPTION: " + e);

   mWebSocketClient = new WebSocketClient(uri) {
       public void onOpen(ServerHandshake serverHandshake) {
           Log.d(TAG, "SERVER HANDSHAKE");
           mWebSocketClient.send("Hello from " + Build.MANUFACTURER + " " + Build.MODEL);

       public void onWebsocketHandshakeSentAsClient(WebSocket conn, ClientHandshake request) throws InvalidDataException {
           super.onWebsocketHandshakeSentAsClient(conn, request);
           Log.d(TAG, "HANDSHAKE SENT AS CLIENT");

       public void onWebsocketHandshakeReceivedAsClient(WebSocket conn, ClientHandshake request, ServerHandshake response) throws InvalidDataException {
           super.onWebsocketHandshakeReceivedAsClient(conn, request, response);

       public void onMessage(String s) {
           final String message = s;
           Log.d(TAG, "ON MESSAGE: " + s);
           runOnUiThread(new Runnable() {
               public void run() {
                   //TextView textView = (TextView)findViewById(;
                   //textView.setText(textView.getText() + "\n" + message);

       public void onMessage(ByteBuffer bytes) {
           Log.d(TAG, "ON MESSAGE");

       public void onClose(int i, String s, boolean b) {
           Log.d(TAG, "Closed " + s);

       public void onError(Exception e) {
           Log.d(TAG, "ERROM MESSAGE: " + e.getMessage());