ezhes / OSXMessageProxy

An API for OSX's Messages app which provides full iMessage capabilities!
MIT License
84 stars 13 forks source link

Very slow message delivey #9

Closed amvidalrc closed 7 years ago

amvidalrc commented 7 years ago

Hello. Congrats for this great project. I have an issue but I don't know if it belongs to the project.

When I write a message from Andromeda I see that the Mac makes some steps like putting iMessage on front, open a new conversation (even if there is an open conversation) and writes the message. For each message the program takes 20 seconds - 30 seconds.

I can not send more than 1 message in a 1 minute period. If I do it the server only send the first one.

Thanks for your great efforts.

ezhes commented 7 years ago

This is odd, my server only takes about 8-15 seconds and the server itself also supports queueing so you should be able to send hundreds of messages from the client and the server will work through them all. Can you attach the logs from ~/Library/MessageProxy for today's date?

The bit about opening a new conversation is necessary because there is no other way to send a message to a specific chat. Do you have a spectacularly slow computer? I started off trying to use my pretty messed up 2010 mac mini and it took so long to look up contacts that it would often fail to send messages.

Do you get a notification saying the messages failed to send?

amvidalrc commented 7 years ago

I will attach it when I'm on home. I'm using a Mac Mini like you (Core 2 Duo, 4Gb RAM, OS X 10.11). I look that when the server is looking for the contact, It remains some seconds on the contact lookup with the contact selected. I will send log and a little video.

Maybe is the same issue with your Mac Mini.

ezhes commented 7 years ago

The server waits 2.5 seconds per person it sends to. This is so the auto fill works on non SSD computers. If it takes 30 seconds to send to one person I'm concerned but if you're sending to an unnamed group chat of 32 people that's just how it works. Name you big group chats and it will just type in the name.

ezhes commented 7 years ago

For example I just sent a message to someone and it sent the whole thing in just 8 seconds (timed from the moment the sent banner shows up to when the bubble was being sent by the server app.

ezhes commented 7 years ago

Are you still having this problem? Could you also try the new client and server software?

amvidalrc commented 7 years ago

I have upgraded resources to the machine and it's taking a bit less. I will try the new server and client today and let you know.

Best regards

via Newton Mail [https://cloudmagic.com/k/d/mailapp?ct=pa&cv=9.4.53&pv=7.0&source=email_footer_2] On Sun, May 07, 2017 at 6:39am, Salman Husain < notifications@github.com [notifications@github.com] > wrote: Are you still having this problem? Could you also try the new client and server software?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub [https://github.com/shusain93/OSXMessageProxy/issues/9#issuecomment-299682036] , or mute the thread [https://github.com/notifications/unsubscribe-auth/AIklNc4LKH4aW0IhIwRlF0N5GHMD4O3Oks5r3Ur1gaJpZM4NRYSw] .

amvidalrc commented 7 years ago

Shusain, with the new version works like a charm. I don't know why, but it's working perfect now. Thanks for all your efforts with this server, I have moved from IOS to Galaxy S8+ for testing and it's very nice to talk with iMessage from the S8+. In the last version I use nginx for SSL encription, I think with this new version is not possible, can you confirm? (Beacuse you are looking the port and no the webserver).

ezhes commented 7 years ago

Actually it works just the same but it looks like I've found your issue then if it works perfectly now. If your Nginx server is on the same IP as your other hidden server it'll work if you just punch in the hostname and port, assuming you haven't done anything that would require a special path. It would have to be completely transparent and one to one meaning that it forwards server:port/isUp directly. You could modify the Android app if you do need a special path offset.

I understand how important encryption is and I think I'll switch to a different webserver soon (IBM has an amazing group of libraries for swift). It's not going to be this weekend but maybe next.

Could you try an older version of the client which you know works with the proxy server and time it with an without the encrypted middle?

amvidalrc commented 7 years ago

Hello Shusain. Im using VestaCP for Nginx and other clients management. I have an URL proxying to my Mac (https://subdomain.domain.es) -> http://x.x.x.x:8735 using free SSL certificate (Let's encrypt). With the new version is not working, beacuse I can not proxify 2 different ports on the same proxying URL. I would need to use 2 URLs for proxify the Web API and the Socket Port. Maybe I try to modify and do some test for encrypt both ports.

I have done the test for timing:

Andromeda to local IP (HTTP) directly (old version so more time): 22 seconds to deliver. Andromeda to HTTPS Proxy: 18 seconds to deliver. O.O Less time to send over Nginx.

ezhes commented 7 years ago

Don't bother trying to encrypted the socket, it'll probably be replaced next weekend with a fully functional ssl setup for both the socket and server.

I don't think you'll be able to proxify the socket since it's actually just a raw TCP socket and so you'd have to wrap up the protocol and so while it's possible to just VPN the whole thing it sort of defeats the whole idea of ease of use.

When running the server, do you see a massive spike in CPU usage? I never did find out why my Mac mini server was so awfully slow but I assumed it was mainly the contact look up that the iMessage app does and so having either an SSD or not thousands of contacts with photos and all might solve it. My 2011 Mac book air that I leave plugged in the corner fires of messages perfectly fast. If it actually works fine I honestly couldn't tell you why since as far as I know nothing changed but hey maybe just the replacement and restart fixed it.

amvidalrc commented 7 years ago

I have tested on the same Mac Mini and worked like a charm. Now, I have moved to a Proxmox Virtualized Infraestructure (to have the server 24/7) so now I have a Virtual Machine running 10.12 with the server only for iMessage, with every services disabled and work little more fast than Mac Mini.

This is the resource monitor only running the MessageProxy, iCloud Services and iMessage: image

Now I can't see any CPU peaks.

ezhes commented 7 years ago

I think your issue is solved then. I opened #10 as a sort of improvement for what you're asking. Once I get around next weekend to adding this it'll only need to fall back to this slower UI scripting version when it's a group chat. Standard 1:1 chats should then theoretically have a send time of <1 second so big speed improvement.

Also I've never heard of a VPS service with OSX machines. Does that cost you a ton? Might be a good idea to move myself onto a VPS eventually.

amvidalrc commented 7 years ago

I have installed myself in my own virtual infrastructure so no cost. It's free. It's a KVM machine based on QEMU.

You can follow the guide that I have used here: http://www.nicksherlock.com/2016/10/installing-macos-sierra-on-proxmox-4-3-qemu-2-6-1/

I will wait for the new version then. Thanks again for your work.