B.2.3 Socket Connections

Hello,

here the proposal for the Socket Connection section.


Jan-Klaas Kollhof





B.2.3 Socket Connections

The Connection interface provides an API for socket-level communication.
A Connection object is created using the SVGGlobal interface 'createConnection()'.
After a connection has been established using the 'connect()' method the
Connection object must dispatch a 'ConnectionConnected' event.  In the
circumstance that the connection is closed by any peer, a 'ConnectionClosed'
event must be dispatched. A 'ConnectionError' event must be dispatched in
case of any error and should give information about the error in the event's
'data' attribute.

Upon data reception, the Connection object must dispatch a 'ConnectionData'
event. The event's 'data' attribute must contain the data received.
The Connection object must support the following encoding: UTF-8/16LE and UTF-16BE
The default encoding is UTF-16 and may be reset using 'setEncoding()' at any time.
All data sent must be encoded using the currently set encoding.
Data received is interpreted as being data in the same encoding as set for the Connection object.


-------------proposal---------------
Raw byte data encoding:

For sending byte data, the lower 8 bits of each character's charcode is sent.
Arriving data must be interpreted such that each byte arriving represents the
charcode for a single character in the resulting data attribute of the
'ConnectionData' event. 
-------------------------------------



interface ConnectionEvent : events::Event {
    //target attribute must be a reference to the Connection object 
}; 

interface ConnectionData : ConnectionEvent {
    readonly attribute DOMString data;
};

interface ConnectionClosed : ConnectionEvent { 
}; 

interface ConnectionError : ConnectionEvent {
    readonly attribute DOMString data;  // Error data 
}; 

interface ConnectionConnected : ConnectionEvent { 

};

interface Connection : events::EventTarget {
    readonly attribute boolean connected;
   
    void setEncoding(DOMString value);   //may be called before connect
    void connect( in DOMString url ) raises(DOMException)  // e.g. 123.123.123.123:4321,  some-server.xyz:80
    void send( in DOMString data );
    void close();
};



-- 
_________________________________________________

 Jan-Klaas Kollhof
 Founding Partner, Vectoreal
 http://www.vectoreal.com
 
 phone: +49 174 968 9477
 email: jan@kollhof.net
 web: http://jan.kollhof.net
_________________________________________________

Received on Wednesday, 24 November 2004 13:03:51 UTC