0

I am working through the realm swift tutorial found here.

Once I completed the tutorial successfully on my local machine I deployed the realm object server on a Ubuntu digital ocean server.

Now when I run the code on my dev machine pointing to the server I get the error message:

Connecting to endpoint '139.59.102.91:80' (1/1)
2017-02-20 20:29:27.576 RealmTasksTutorial[9998:243100] Sync: Connection[1]: Failed to connect to endpoint '139.59.102.91:80': Connection refused

The problem, might be, that when you work through the tutorial it gets you to start up their Mac app and create a task. Then you move to the next step and create the iOS app. In the iOS app, in the SetupRealm() they synch with the realm server with the following lines:

if self.items.realm == nil, let list =  self.realm.objects(TaskList.self).first {
 self.items = list.items
}

This will only populate self.items if the realm server has that first task added (by the Mac app). So the tutorial works fine when all is run on my local machine.

The problem is when I deploy the realm object server to the digital ocean Ubuntu instance. There is no Mac app to populate that first task.

Is there a better way to check realm and initialize/populate self.items?

maciekjanusz
  • 4,702
  • 25
  • 36
grabury
  • 4,797
  • 14
  • 67
  • 125

1 Answers1

0

I believe the problem comes from the port you are using.

The default configuration of the Realm Object Server runs on port 9080 for HTTP/WebSocket, and 9443 if you enable TLS. It would appear your client is trying to connect to port 80, the default port if you don't specify anything otherwise.

Try adding :9080 to your authentication and realm URLs.

teotwaki
  • 1,033
  • 7
  • 10