Titanium.Network

Submodule of Titanium.
Platform Since
Android 0.1
iPhone 0.1
iPad 0.1
Mobile Web 1.8

Summary

The top level network module.

Description

The Network module is used to access networking related functionality.

For TCP sockets, see Titanium.Network.Socket.TCP.

The legacy Titanium.Network.TCPSocket object is still required by the BonjourBrowser and BonjourService objects.

For all other socket needs, use Titanium.Network.Socket.TCP.

Objects

Name Summary
Titanium.Network.BonjourBrowser

A browser for the discovery and retrieval of Bonjour services available on the network. (iPhone, iPad only.)

Titanium.Network.BonjourService

Describes a service on the network which is published by Bonjour. (iPhone, iPad only.)

Titanium.Network.HTTPClient

HTTP client object that (mostly) implements the XMLHttpRequest specification.

Titanium.Network.TCPSocket

Deprecated DEPRECATED: USE Titanium.Network.Socket.TCP WHERE POSSIBLE. 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. (iPhone, iPad only.)

Methods

Name Summary
addConnectivityListener

Deprecated Use the change event to monitor connectivity changes. (iPhone, iPad only.)

addEventListener

Adds the specified callback as an event listener for the named event.

createBonjourBrowser

Creates and returns a BonjourBrowser object. (iPhone, iPad only.)

createBonjourService

Creates and returns a BonjourService object. (iPhone, iPad only.)

createHTTPClient

Create and return an instance of Titanium.Network.HTTPClient.

createTCPSocket

Deprecated Use Titanium.Network.Socket.createTCP instead. (iPhone, iPad, Mobile Web only.)

decodeURIComponent

Returns a decoded version of a URI encoded value.

encodeURIComponent

Returns a URI encoded version of the specified URI component.

fireEvent

Fires a synthesized event to any registered listeners.

getAddress

Gets the value of the address property.

getHttpURLFormatter

Gets the value of the httpURLFormatter property. (Mobile Web only.)

getNetworkType

Gets the value of the networkType property.

getNetworkTypeName

Gets the value of the networkTypeName property.

getOnline

Gets the value of the online property.

getRemoteDeviceUUID

Gets the value of the remoteDeviceUUID property. (iPhone, iPad only.)

getRemoteNotificationTypes

Gets the value of the remoteNotificationTypes property. (iPhone, iPad only.)

getRemoteNotificationsEnabled

Gets the value of the remoteNotificationsEnabled property. (iPhone, iPad only.)

registerForPushNotifications

Registers for push notifications with the Apple Push Notification Service. (iPhone, iPad only.)

removeConnectivityListener

Deprecated Use the change event to monitor connectivity changes. (iPhone, iPad only.)

removeEventListener

Removes the specified callback as an event listener for the named event.

setAddress

Sets the value of the address property.

setHttpURLFormatter

Sets the value of the httpURLFormatter property. (Mobile Web only.)

unregisterForPushNotifications

Unregisters the application for push notifications.

Properties

Name Type Summary
INADDR_ANY String

Deprecated Special hostname value for listening sockets, representing all locally available network interfaces. (iPhone, iPad, Mobile Web only.) read-only

NETWORK_LAN Number

A networkType value indicating that the device is communicating over a local-area network. read-only

NETWORK_MOBILE Number

A networkType value indicating that the device is communicating over a mobile network. read-only

NETWORK_NONE Number

A networkType value indicating that no network is available. read-only

NETWORK_UNKNOWN Number

A networkType value indicating that the
current network type is unknown. read-only

NETWORK_WIFI Number

A networkType value indicating that the
device is communicating over a WiFi network. read-only

NOTIFICATION_TYPE_ALERT Number

Constant value for an Alert style push notification. (iPhone, iPad only.) read-only

NOTIFICATION_TYPE_BADGE Number

Constant value for a Badge style push notification. (iPhone, iPad only.) read-only

NOTIFICATION_TYPE_SOUND Number

Constant value for a Sound style push notification. (iPhone, iPad only.) read-only

READ_MODE Number

Deprecated Constant value specifying read-only mode for sockets. (iPhone, iPad, Mobile Web only.) read-only

READ_WRITE_MODE Number

Deprecated Constant value specifying read-write mode for sockets. (iPhone, iPad, Mobile Web only.) read-only

SOCKET_CLOSED Number

Deprecated Constant value representing a socket in the CLOSED state. (iPhone, iPad only.) read-only

SOCKET_CONNECTED Number

Deprecated Constant value representing a socket in the CONNECTED state. (iPhone, iPad only.) read-only

SOCKET_ERROR Number

Deprecated Constant value representing a socket in the ERROR state. (iPhone, iPad only.) read-only

SOCKET_INITIALIZED Number

Deprecated Constant value representing a socket in the INITIALIZED state. (iPhone, iPad only.) read-only

SOCKET_LISTENING Number

Deprecated Constant value representing a socket in the LISTENING state. (iPhone, iPad only.) read-only

TLS_VERSION_1_0 Number

Constant value specifying TLS version 1.0 for SSL. (iPhone, iPad only.) read-only

TLS_VERSION_1_1 Number

Constant value specifying TLS version 1.1 for SSL. (iPhone, iPad only.) read-only

TLS_VERSION_1_2 Number

Constant value specifying TLS version 1.2 for SSL. (iPhone, iPad only.) read-only

WRITE_MODE Number

Deprecated Constant value specifying write-only mode for sockets. (iPhone, iPad, Mobile Web only.) read-only

address String

The IP address of the device's WiFi network interface.

httpURLFormatter Callback<String>

User-defined function that is called everytime HTTPClient connects to a remote resource. (Mobile Web only.)

networkType Number

Network type value as a constant. read-only

networkTypeName String

Network type as a String. Returns one of NONE, WIFI, LAN, MOBILE, or UNKNOWN. read-only

online Boolean

Boolean value indicating if the device can reach the Internet. read-only

remoteDeviceUUID String

Remote device UUID if the device is registered with the Apple Push Notification Service, or null if it is not registered. (iPhone, iPad only.) read-only

remoteNotificationTypes Array<Number>

Array of push notification type constants enabled for the application. (iPhone, iPad only.) read-only

remoteNotificationsEnabled Boolean

Indicates whether push notifications have been enabled using registerForPushNotifications. (iPhone, iPad only.) read-only

Events

Name Summary
change

Fired when network connectivity changes.