Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24017] iOS: Add support for headers to the log server

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-10-13T10:21:09.000+0000
Affected Version/sn/a
Fix Version/sRelease 6.0.0
ComponentsiOS, Tooling
Labelsn/a
ReporterChris Barber
AssigneeChris Barber
Created2016-10-11T23:19:51.000+0000
Updated2017-03-20T17:11:06.000+0000

Description

When a client connects to the log server in the iOS app, it would helpful for the server to immediately respond with information about the app including the app id, version, environment (sim/device), and deploy type. The format can be simple and basically mimic how HTTP works. When a new connection is accepted, it would immediately write:
id: com.foo.bar
name: Testapp
version: 1.0.0
deploy-type: development
titanium-sdk: 6.0.0

The client will interpret all lines prior to \n\n to be a header. Subsequent lines are to be interpreted as log lines. We need this feature so that a client can validate it has connected to the correct log server. It's possible for two different apps to listen on the same work and a client may think it's connecting to one app's log server when in fact it's connecting to another app's log server.

Comments

  1. Chris Barber 2016-10-13

    Published ioslib@1.0.2 PR: https://github.com/appcelerator/ioslib/pull/50
  2. Chris Barber 2016-10-13

    TiSDK master PR: https://github.com/appcelerator/titanium_mobile/pull/8503 TiSDK 6_0_X PR: https://github.com/appcelerator/titanium_mobile/pull/8504 To test:

    Create an app called "testapp1"

    Add <log-server-port>12345</log-server-port> in the <ios> section of the tiapp.xml

    Build app for device

    LEAVE CLI, SIM, & APP RUNNING!

    Open 2nd terminal

    Create an app called "testapp2"

    Add <log-server-port>12345</log-server-port> in the <ios> section of the tiapp.xml

    Build app for device

    NOTE: The app ids must be different. It should error when the CLI tries to 2nd app tries to connect to the 2nd app's log server.
  3. Chee Kiat Ng 2016-10-13

    I used the test step after scons'ing the PR from 6_0_X. doesn't error out, still logging independently of each other. [~hansknoechel] if you have time test it out too?
  4. Chris Barber 2016-10-13

    OK, so this is probably impossible to test with the simulator because my code is too smart. If you look at the build log output for the first app, it will select the port 12345. However, if you look at the build log output for the 2nd app, it will say a different port than 12345. Why is this you might ask? The build starts a local Node.js server to make sure that the port is available since the iOS Simulator shares ports with the local machine. For device builds, we can't tell if a port is available unless we try connecting to it. We could test the port, but this is not foolproof. If testapp1 is not running when testapp2 is building, but testapp1 is launched while testapp2 is being installed, then you'll still run into the problem that this ticket attempts to solve. So, if you do the above steps for a device build, it should show the error for the 2nd app.
  5. Chee Kiat Ng 2016-10-13

    Great work! APPROVED!
  6. Lee Morris 2017-03-20

    Closing ticket as fixed.

JSON Source