5

I'm using Twilio programmable chat on swift and it takes the client up to 5 seconds to connect.

Here is the code:

let start = Date()

TwilioChatClient.chatClient(withToken: token, properties: nil, delegate: self) {
                (result, chatClient) in

                print("\(Date().timeIntervalSince(start)) seconds")

            }

This prints values between 3.5 to 5 seconds.

After connecting, the other apis works pretty fast, for example sending message 0.2 sec.

Does that make sense?

Rotem
  • 2,306
  • 3
  • 26
  • 44
  • I'm not sure what you're asking here. There is an amount of setup that the client needs to do before you can send messages or join channels, so I would assume it would take longer than just sending a message. If you have specific concerns about the connection time I recommend you get in touch with [Twilio support](https://www.twilio.com/help/contact). – philnash Sep 28 '17 at 16:55
  • 1
    Well, I guess what I'm asking here if it makes sense that a client would need to wait 5 seconds before able to send a message? – Rotem Sep 30 '17 at 04:46
  • This might be a latency issue, where are you connecting to Twilio Chat from? – philnash Oct 02 '17 at 10:06
  • Wifi, and I remind you that after that sending a message is very fast – Rotem Oct 02 '17 at 10:47
  • Sorry, I meant the geographical location! And like I said, the initial connection requires a number of round trips to authenticate the user then setup the websocket connection. Once the websocket is setup, I would expect that to be much quicker regardless. – philnash Oct 02 '17 at 10:52
  • Yeah after the websocket is read then it is fast. The thing is that in other messaging apps like Telegram for example, the initial connection takes 100 milliseconds... – Rotem Oct 02 '17 at 11:10
  • And this is why I'm asking where you are located when you are testing this. – philnash Oct 02 '17 at 14:12
  • I'm failing to understand why does it matter where I'm located if sending a message is extremely fast – Rotem Oct 02 '17 at 14:57
  • Well, the overhead for setting up the connection is likely increased by your location. Currently the chat authentication server is located in the US, so if you're the other side of the world then that might be the issue. We're also testing rolling out geographies, so I might be able to help you get on something more local that might be faster. – philnash Oct 02 '17 at 16:11
  • I'm currently located in Israel but we have customers from all around the world. – Rotem Oct 03 '17 at 10:46
  • Ok, what I recommend is that you write into [Twilio support](https://www.twilio.com/help/contact) to describe the issue and length of time things are taking. It would help to include any logs that you have, especially with the client set to debug logging. This will help prioritise work to distribute chat instances and the team will be able to keep you informed about it. – philnash Oct 03 '17 at 11:01

0 Answers0