Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Does Appcelerator support TLS/SSL Sockets?

A similar question was asked three months ago and has no response. Do Appcelerator developers read these forums? All I'm looking for is a "Yes, check out <link>" or "No, sorry"

Secure sockets are a must-have for our application, but I couldn't find any documentation about them in the Docs pages.

— asked September 21st 2010 by Christopher Rivers
  • secure
  • sockets
  • ssl
  • tls

4 Answers

  • Appcelerator people, Can you please reply to this thread.
    It would save a lot of hours of lot many people if you can answer this simple question, whether SSL/TLS is supported with Titanium.Network.Socket.TCP or not.
    If you go by documentation and following issues TIMOB-6211,
    TIMOB-6212 then the clear answer is No.
    But the above issues were raised in the year 2011, and so I am still guessing&expecting some work around to be available in the latest release.

    — answered December 16th 2013 by Vishal Kumar Singh
  • I'm not sure if this is what you meant, but I am currently building an application that makes AJAX calls to an https:// address, and it seems to work just fine. I can also open a window with an SSL address/URL and it opens fine.

    — answered September 21st 2010 by Riley Dutton
    • Thanks for the response. I'm specifically interested in direct socket connections rather than going over HTTP. Using ajax requests with a https url mean that at least something is doing the SSL handshake, but it's not clear whether it's possible to apply that to a TCP socket connection.

      — commented September 21st 2010 by Christopher Rivers
    • Any updates on the TLS Sockets? Would loved to use them…

      — commented January 28th 2011 by David Bankier
  • Does anyone have an android solution? Need solutions.

    — answered December 30th 2012 by Aee Q
  • hope this helps :) I finally get it work!

    1. go to build/iphone/Classes
    2. edit TiNetworkTCPSocketProxy.mm
    3. find initializeReadStream function

    4. before this line:

      CFReadStreamSetProperty((CFReadStreamRef)input, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);

      add this

      [input setProperty:NSStreamSocketSecurityLevelNegotiatedSSL forKey:NSStreamSocketSecurityLevelKey];
    5. find initializeWriteStream (it's just after the other function)

    6. ídem:
      [output setProperty:NSStreamSocketSecurityLevelNegotiatedSSL forKey:NSStreamSocketSecurityLevelKey];

    CFWriteStreamSetProperty((CFWriteStreamRef)output, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue);

    1. full rebuild (remove all the files/dirs inside build/iphone) and the make

    I changed both functions because U use full duplex sockets (R+W)… don't know whether you need to for R only / W only sockets or not.

    IMPORTANT: better change the source from the SDK, avoiding being rewritten by Titanium…

    — answered February 10th 2011 by jordi domenech
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.