chrome.experimental.socket
For information on how to use experimental APIs, see the chrome.experimental.* APIs page.
API reference: chrome.experimental.socket
Properties
getLastError
chrome.extensionlastError
Methods
close
void
chrome.experimental.socket.close(, integer
socketId)
Undocumented.
Closes the socket.
Parameters
-
socketId
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The socketId.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...};
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
connect
void
chrome.experimental.socket.connect(, integer
socketId, string
hostname, integer
port, function
callback)
Undocumented.
Connects the socket to the given address. In the case of a UDP socket, this method merely associates the address with the socket for future sent data.
Parameters
-
socketId
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The socketId.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
hostname
(
optional
enumerated
Type
array of
string
)
-
Undocumented.
- The remote hostname.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
port
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The remote port.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
callback
(
optional
enumerated
Type
array of
function
)
-
Undocumented.
- Called when the connection is complete.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(boolean result) {...};
-
result
(
optional
enumerated
Type
array of
boolean
)
-
Undocumented.
- True if successful, false otherwise.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
create
void
chrome.experimental.socket.create(, string
type, object
options, function
callback)
Undocumented.
Creates a socket of the specified type.
Parameters
-
type
(
optional
enumerated
Type
array of
string
["udp"]
)
-
Undocumented.
- The type of socket to create. Must be
udp
.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
options
(
optional
enumerated
Type
array of
object
)
-
Undocumented.
- The socket options.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
onEvent
(
optional
enumerated
Type
array of
function
)
-
Undocumented.
- This function is called with events that occur during the lifetime of the socket.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
Parameters
-
event
-
Undocumented.
- The socket event.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
-
-
-
callback
(
optional
enumerated
Type
array of
function
)
-
Undocumented.
- Called when the socket has been created.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(object socketInfo) {...};
-
socketInfo
(
optional
enumerated
Type
array of
object
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
socketId
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The id of the newly created socket.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
-
-
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
destroy
void
chrome.experimental.socket.destroy(, integer
socketId)
Undocumented.
Destroys the socket. Each socket created should be destroyed after use.
Parameters
-
socketId
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The socketId.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(Type param1, Type param2) {...};
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
write
void
chrome.experimental.socket.write(, integer
socketId, string
data, function
callback)
Undocumented.
Writes data on the connected socket.
Parameters
-
socketId
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The socketId.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
data
(
optional
enumerated
Type
array of
string
)
-
Undocumented.
- The data to write. Warning: will probably become a blob or other appropriate binary-friendly type.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
callback
(
optional
enumerated
Type
array of
function
)
-
Undocumented.
- Called when any of the following happens: the write operation completes, the write operation blocked before completion, or an error occurred.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
Returns
Callback function
The callback parameter should specify a function
that looks like this:
If you specify the callback parameter, it should
specify a function that looks like this:
function(object writeInfo) {...};
-
writeInfo
(
optional
enumerated
Type
array of
object
)
-
Undocumented.
-
Description of this parameter from the json schema.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
bytesWritten
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The number of bytes sent, or a negative error code.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
-
-
This function was added in version .
If you require this function, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
Events
event name
chrome.bookmarksonEvent.addListener(function(Type param1, Type param2) {...}, Type opt_param1, Type opt_param2);
Undocumented.
A description from the json schema def of the event goes here.
Extra parameters to addListener
Listener returns
Types
SocketEvent
paramName
(
optional
enumerated
Type
array of
object
)
Undocumented.
A socket event.
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
type
(
optional
enumerated
Type
array of
string
["data", "error"]
)
-
Undocumented.
- A 'data' event represents data received on the socket. An 'error' event represents an error.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
byteCount
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The number of bytes received in a 'data' event.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
bytes
(
optional
enumerated
Type
array of
blob
)
-
Undocumented.
- The data received.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
errorCode
(
optional
enumerated
Type
array of
integer
)
-
Undocumented.
- The error code, if the event type is 'error'.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-
-
errorMessage
(
optional
enumerated
Type
array of
string
)
-
Undocumented.
- The error description, if the event type is 'error'.
-
This parameter was added in version
.
You must omit this parameter in earlier versions,
and you may omit it in any version. If you require this
parameter, the manifest key
minimum_chrome_version
can ensure that your extension won't be run in an earlier browser version.
-
-
-
-