Titanium.Network

submodule of Titanium
           
0.1

The top level Network module. The Network module is used accessing Networking related functionality.

Objects

Name Description
Titanium.Network.BonjourBrowser

The BonjourBrowser instance returned from Titanium.Network.createBonjourBrowser. This object is a browser for the discovery and retrieval of Bonjour services available on the network.

Titanium.Network.BonjourService

The BonjourService instance returned either from Titanium.Network.createBonjourService or via the service list from a BonjourBrowser updatedServices event. This object describes a service on the network which is published by Bonjour.

Titanium.Network.HTTPClient

The HttpClient instance returned from Titanium.Network.createHTTPClient. This object (mostly) implements the XMLHttpRequest specification.

Titanium.Network.TCPSocket

The TCPSocket instance returned from Titanium.Network.createTCPSocket. This object represents a socket which either listens locally on the device for connections, or connects to a remote machine.

Methods

Name Description
addConnectivityListener

adds a connectivity listener to listen for network changes. This method has been deprecated in favor of listening for a change event.

addEventListener add an event listener for the instance to receive view triggered events
createBonjourBrowser create and return an instance of Titanium.Network.BonjourBrowser
createBonjourService create and return an instance of Titanium.Network.BonjourService
createHTTPClient create and return an instance of Titanium.Network.HTTPClient
createTCPSocket create and return an instance of Titanium.Network.TCPSocket
decodeURIComponent

decode a URI component part using URI encoding

encodeURIComponent

encode a URI component part using URI encoding

fireEvent fire a synthesized event to the views listener
registerForPushNotifications

register for push notifications with the Apple Push Notification Service. Only available on iPhone.

removeConnectivityListener

removes a connectivity listener. This method has been deprecated in favor of listening for a change event.

removeEventListener remove a previously added event listener

Properties

Name Type Description
INADDR_ANY string

constant value representing the ability for sockets to listen on any locally available network device

NETWORK_LAN int

constant value to indicate that the network is LAN

NETWORK_MOBILE int

constant value to indicate that the network is MOBILE

NETWORK_NONE int

constant value to indicate that the network is not available

NETWORK_UNKNOWN int

constant value to indicate that the network is not known

NETWORK_WIFI int

constant value to indicate that the network is WIFI

NOTIFICATION_TYPE_ALERT int

constant value for the push notification alert type

NOTIFICATION_TYPE_BADGE int

constant value for the push notification badge type

NOTIFICATION_TYPE_SOUND int

constant value for the push notification sound type

READ_MODE int

constant value specifying read-only mode for sockets

READ_WRITE_MODE int

constant value specifying read-write mode for sockets

WRITE_MODE int

constant value specifying write-only mode for sockets

networkType int

the network type value as a constant.

networkTypeName string

the network type name constant. Returns one of NONE, WIFI, LAN or MOBILE.

online boolean

readonly boolean value that indicates if the network is reachable to the Internet either via WIFI or Carrier network

remoteDeviceUUID string

the remote device UUID if the device was registered with the Apple Push Notification Service or null if not set. Only available on iPhone.

remoteNotificationTypes array

returns an array of network type constants enabled for the application. Only available on iPhone.

remoteNotificationsEnabled boolean

returns true if remote notifications have been enabled. Only available on iPhone.

Events

Name Description
change

fired upon a network connectivity change

Event properties

networkType

the new network type

networkTypeName

the new network type as a string

online

boolean to indicate if the network is online

sourcethe source object that fired the event
typethe name of the event fired