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. The Network module is used accessing Networking related functionality, including Titanium.Network.Socket

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

The HttpClient instance returned from Titanium.Network.createHTTPClient. This object (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, Mobile Web only.)

Methods

Name Summary
addConnectivityListener

Deprecated adds a connectivity listener to listen for network changes. This method has been deprecated in favor of listening for a change event. (iPhone, iPad only.)

addEventListener

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

createBonjourBrowser

create and return an instance of Titanium.Network.BonjourBrowser (iPhone, iPad only.)

createBonjourService

create and return an instance of Titanium.Network.BonjourService (iPhone, iPad only.)

createHTTPClient

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

createTCPSocket

Deprecated create and return an instance of Titanium.Network.TCPSocket (iPhone, iPad, Mobile Web only.)

decodeURIComponent

decode a URI component part using URI encoding

encodeURIComponent

encode a URI component part using URI encoding

fireEvent

Fires a synthesized event to any registered listeners.

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

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

removeConnectivityListener

Deprecated removes a connectivity listener. This method has been deprecated in favor of listening for a change event. (iPhone, iPad only.)

removeEventListener

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

setHttpURLFormatter

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

setRemoteDeviceUUID

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

setRemoteNotificationTypes

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

setRemoteNotificationsEnabled

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

Properties

Name Type Summary
INADDR_ANY String

constant value representing the ability for sockets to listen on any locally available network device (iPhone, iPad, Mobile Web only.) read-only

NETWORK_LAN Number

constant value to indicate that the network is LAN (iPhone, iPad, Mobile Web only.) read-only

NETWORK_MOBILE Number

constant value to indicate that the network is MOBILE (iPhone, iPad, Mobile Web only.) read-only

NETWORK_NONE Number

constant value to indicate that the network is not available (iPhone, iPad, Mobile Web only.) read-only

NETWORK_UNKNOWN Number

constant value to indicate that the network is not known (iPhone, iPad, Mobile Web only.) read-only

NETWORK_WIFI Number

constant value to indicate that the network is WIFI (iPhone, iPad, Mobile Web only.) read-only

NOTIFICATION_TYPE_ALERT Number

constant value for the push notification alert type (iPhone, iPad, Mobile Web only.) read-only

NOTIFICATION_TYPE_BADGE Number

constant value for the push notification badge type (iPhone, iPad, Mobile Web only.) read-only

NOTIFICATION_TYPE_SOUND Number

constant value for the push notification sound type (iPhone, iPad, Mobile Web only.) read-only

READ_MODE Number

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

READ_WRITE_MODE Number

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

SOCKET_CLOSED Number

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

SOCKET_CONNECTED Number

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

SOCKET_ERROR Number

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

SOCKET_INITIALIZED Number

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

SOCKET_LISTENING Number

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

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

httpURLFormatter Callback<String>

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

networkType Number

the network type value as a constant. read-only

networkTypeName String

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

online Boolean

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

remoteDeviceUUID String

the remote device UUID if the device was registered with the Apple Push Notification Service or null if not set. (iPhone, iPad only.)

remoteNotificationTypes Array<Object>

returns an array of network type constants enabled for the application. (iPhone, iPad only.)

remoteNotificationsEnabled Boolean

returns true if remote notifications have been enabled. (iPhone, iPad only.)

Events

Name Summary
change

fired upon a network connectivity change