CN106257887A - A kind of method that obtains client hardware information of sing on web Socket - Google Patents

A kind of method that obtains client hardware information of sing on web Socket Download PDF

Info

Publication number
CN106257887A
CN106257887A CN201510342151.XA CN201510342151A CN106257887A CN 106257887 A CN106257887 A CN 106257887A CN 201510342151 A CN201510342151 A CN 201510342151A CN 106257887 A CN106257887 A CN 106257887A
Authority
CN
China
Prior art keywords
client
hardware information
websocket
function
self
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201510342151.XA
Other languages
Chinese (zh)
Other versions
CN106257887B (en
Inventor
胡琳琳
肖伟民
郭志川
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Institute of Acoustics CAS
Shanghai 3Ntv Network Technology Co Ltd
Original Assignee
Institute of Acoustics CAS
Shanghai 3Ntv Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Institute of Acoustics CAS, Shanghai 3Ntv Network Technology Co Ltd filed Critical Institute of Acoustics CAS
Priority to CN201510342151.XA priority Critical patent/CN106257887B/en
Publication of CN106257887A publication Critical patent/CN106257887A/en
Application granted granted Critical
Publication of CN106257887B publication Critical patent/CN106257887B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/133Protocols for remote procedure calls [RPC]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention provides a kind of method obtaining client hardware information of sing on web Socket, described method includes: step 1) JavaScript interface function self-defined to common Web Socket object extension;Step 2) client creates WebSocket object, and sets up and the connection of server, calls described step 1) extension self-defined JavaScript interface function;Step 3) Web engine kernel obtains relevant device hardware information according to the interface function of WebSocket object reference, returns to client;Step 4) the device hardware information of return is included in data message and is sent to server by client;Step 5) data message processes, and according to device hardware information, result returned to client by described server;Step 6) client according to return result continue server is sent datagram, until it is complete to communicate;Step 7) communication after, close WebSocket connect.

Description

A kind of method that obtains client hardware information of sing on web Socket
Technical field
The invention belongs to network communication field, be specifically related to a kind of sing on web Socket and obtain client hardware information Method.
Background technology
The ripe day by day and the final shaping of HTML5 specification of HTML5 technology, as an emerging technology and tool The cross-platform characteristic of standby support, HTML5 is increasingly welcome by developer.WebSocket closes as HTML5 One of key technology, it is supported full-duplex communication and saves the advantage of the network bandwidth, being also that developers are carrying out Web The communication mode of prioritizing selection during the exploitation of application communication even Overpassing Platform by Using.
In standard WebSocket agreement, attribute and method ratio that WebSocket object has are relatively limited, such as: belong to Property value URL, method send and close etc..In exploitation Web application process, sometimes to the datagram sent Literary composition needs the information comprised to have more requirement, such as: need in message to comprise the client initiating WebSocket request End relevant information.But, lack the JavaScript interface by calling extension of a kind of sing on web Socket at present The method obtaining client hardware information.
Needing additionally, due to send datagram to obtain rather than amendment client-side information, some client-side informations are to be subject to To protecting and the most revisable, so JavaScript being obtained relevant information there is certain security requirement.
Summary of the invention
It is an object of the invention to overcome current WebSocket object does not comprise and obtain client hardware information The defect of attribute, it is proposed that a kind of sing on web Socket obtains the method for client hardware information, and the method is passed through Call the JavaScript interface of extension and realize WebSocket object acquisition client hardware information, and the method Safety is high, it is ensured that the hardware information of client can not be modified.
To achieve these goals, the invention provides the acquisition client hardware information of a kind of sing on web Socket Method, described method includes:
Step 1) JavaScript interface function self-defined to common Web Socket object extension;
Step 2) client establishment WebSocket object, and set up the connection with server, call described step 1) Extension self-defined JavaScript interface function;
Step 3) Web engine kernel obtains relevant device hardware letter according to the interface function of WebSocket object reference Breath, returns to client;
Step 4) the device hardware information of return is included in data message and is sent to server by client;
Step 5) data message processes by described server, and according to device hardware information, result is returned To client;
Step 6) client according to return result continue server is sent datagram, until it is complete to communicate;
Step 7) communication after, close WebSocket connect.
In technique scheme, described step 1) specifically include:
Step 1-1) in browser kernel, common Web Socket object is added JavaScript interface property value Or method;
Step 1-2) definition step 1-1) the JavaScript interface property value that extends or method be at the letter of browser kernel Number mapping relations, are mapped to browser internal custom function;
Step 1-3) in step 1-2) internal custom function in, call the extension of WebSocket protocol realization The function of self-defining acquisition device hardware information;
Step 1-4) inside WebSocket protocol realization, add self-defining acquisition device hardware information function;
Described self-defining acquisition device hardware information function is Custom Attributes value or the method for WebSocket object, The client device hardware information that particular value is asked is returned as user after calling;Described device hardware information is MAC Address, IP address or device id.
In technique scheme, described step 2) extension self-defined JavaScript interface function be step 1-4) Self-defining acquisition device hardware information function.
Present invention have an advantage that
1, the method for the present invention is by the JavaScript interface in browser kernel extension sing on web Socket agreement, Calling interface can obtain client hardware information, such as MAC Address, IP address, device id etc., and as data A part for message is sent to server;The method is applicable to server requirement and obtains client-side information as mark Situation, particularly has higher practical value in the case of the multi-platform combined operation of multi-client;
2, the method sing on web Socket of the present invention realizes, and WebSocket is the important set of HTML5 agreement Becoming part, it possesses the cross-platform characteristic of HTML5, has bigger advantage in terms of Overpassing Platform by Using;
3, the method obtaining client-side information is packaged in WebSocket agreement by the method for the present invention, passes through The mode of WebSocket object reference obtains read-only property value or function return value, and user can only obtain and can not repair Change client-side information, it is possible to the bigger safety ensureing client-side information.
Accompanying drawing explanation
Fig. 1 is the schematic diagram of the method for the sing on web Socket acquisition client hardware information of the present invention;
Fig. 2 be the present invention from client JavaScript to the function call mistake of browser kernel WebSocket agreement Cheng Tu.
Detailed description of the invention
With specific embodiment, the present invention is described in detail below in conjunction with the accompanying drawings.
As it is shown in figure 1, a kind of method obtaining client hardware information of sing on web Socket, described method has Body includes:
Step 1) JavaScript interface self-defined to common Web Socket object extension;
Described common Web Socket object is all WebSocket objects that client creates;
As in figure 2 it is shown, described step 1) specifically include:
Step 1-1) in browser kernel, common Web Socket object is added JavaScript interface property value Or method;
Step 1-2) definition step 1-1) the JavaScript interface property value that extends or method be at the letter of browser kernel Number mapping relations, are mapped to browser internal custom function;
Step 1-3) in step 1-2) internal custom function in, call the extension of WebSocket protocol realization The function of self-defining acquisition device hardware information;
Step 1-4) inside WebSocket protocol realization, add self-defining acquisition device hardware information function;
Described self-defining acquisition device hardware information function is Custom Attributes value or the method for WebSocket object, The client device hardware information that particular value is asked is returned as user after calling.
Described device hardware information is MAC Address, IP address or device id.
Step 2) client establishment WebSocket object, and set up the connection with server, call described step 1) Extension JavaScript interface function;
Described extension self-defined JavaScript interface function is described step 1-4) self-defining acquisition device hardware Information function.
Step 3) Web engine kernel obtains relevant device hardware letter according to the interface function of WebSocket object reference Breath, returns to client;
Step 4) the device hardware information of return is included in data message and is sent to server by client;
Step 5) data message processes by described server, and according to device hardware information, result is returned To client;
Step 6) client according to return result continue server is sent datagram, until it is complete to communicate;
Step 7) communication after, close WebSocket connect.
Below by obtain client MAC Address as a example by, step 1) the process that implements be:
Assume that server is to reporting the message format requirement to be:
{"operator":"sample","value":"sample","clientMac":"clientMacAddr"}
Then client JavaScript needs the client mac address of acquisition is contained in clientMacAddr field In, key component written in JavaScript mode is as follows:
Websocket=new WebSocket (" ws: //sample/ ");
Var clientMacAddr=websocket.DeviceMAC | | websocket.getDeviceMAC ();
Var msg=" { " operator ": " sample ", " value ": " sample ", " clientMac ": " "+ clientMacAddr+"\"}";
websocket.send(msg);
Wherein, DeviceMAC is the attribute of WebSocket object, and getDeviceMAC () is WebSocket pair The method of elephant.
Browser kernel JavaScript interface self-defining to WebSocket object extension, including with lower part:
In browser kernel, increase WebSocket object JavaScript interface property value DeviceMAC or Method getDeviceMAC ();
Definition JavaScript interface property value or method are in the Function Mapping relation of browser kernel:
DeviceMAC->jsWebSocketDeviceMAC()
getDeviceMAC()->jsWebSocketPrototypeFunctionGetDeviceMAC()
Browser kernel function realize, call WebSocket agreement internal custom function DeviceMAC () or getDeviceMAC();
Inside WebSocket protocol realization, add self-defining function DeviceMAC () or GetDeviceMAC (), it is achieved obtain the function of facility information.The foregoing is only the detailed description of the invention of the present invention, It is not intended to limit protection scope of the present invention, it will be understood by those of skill in the art that without departing from inventive principle On the premise of, technical scheme is modified or equivalent, without departure from technical solution of the present invention Spirit and scope, it all should be contained in protection scope of the present invention.

Claims (3)

1. the method obtaining client hardware information of sing on web Socket, described method includes:
Step 1) JavaScript interface function self-defined to common Web Socket object extension;
Step 2) client establishment WebSocket object, and set up the connection with server, call described step 1) Extension self-defined JavaScript interface function;
Step 3) Web engine kernel obtains relevant device hardware letter according to the interface function of WebSocket object reference Breath, returns to client;
Step 4) the device hardware information of return is included in data message and is sent to server by client;
Step 5) data message processes by described server, and according to device hardware information, result is returned To client;
Step 6) client according to return result continue server is sent datagram, until it is complete to communicate;
Step 7) communication after, close WebSocket connect.
The method obtaining client hardware information of sing on web Socket the most according to claim 1, it is special Levy and be, described step 1) specifically include:
Step 1-1) in browser kernel, common Web Socket object is added JavaScript interface property value Or method;
Step 1-2) definition step 1-1) the JavaScript interface property value that extends or method be at the letter of browser kernel Number mapping relations, are mapped to browser internal custom function;
Step 1-3) in step 1-2) internal custom function in, call the extension of WebSocket protocol realization The function of self-defining acquisition device hardware information;
Step 1-4) inside WebSocket protocol realization, add self-defining acquisition device hardware information function;
Described self-defining acquisition device hardware information function is Custom Attributes value or the method for WebSocket object, The client device hardware information that particular value is asked is returned as user after calling;Described device hardware information is MAC Address, IP address or device id.
The method obtaining client hardware information of sing on web Socket the most according to claim 2, it is special Levy and be, described step 2) extension self-defined JavaScript interface function be step 1-4) self-defining obtain Taking equipment hardware information function.
CN201510342151.XA 2015-06-18 2015-06-18 A method of the acquisition client hardware information based on WebSocket Expired - Fee Related CN106257887B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510342151.XA CN106257887B (en) 2015-06-18 2015-06-18 A method of the acquisition client hardware information based on WebSocket

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510342151.XA CN106257887B (en) 2015-06-18 2015-06-18 A method of the acquisition client hardware information based on WebSocket

Publications (2)

Publication Number Publication Date
CN106257887A true CN106257887A (en) 2016-12-28
CN106257887B CN106257887B (en) 2019-06-18

Family

ID=57714044

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510342151.XA Expired - Fee Related CN106257887B (en) 2015-06-18 2015-06-18 A method of the acquisition client hardware information based on WebSocket

Country Status (1)

Country Link
CN (1) CN106257887B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107888683A (en) * 2017-11-10 2018-04-06 郑州云海信息技术有限公司 A kind of client exchange method and device
CN109144579A (en) * 2018-07-17 2019-01-04 广州睿本信息科技有限公司 A kind of Web system reads the method and computer readable storage medium of hardware
US10572274B2 (en) 2017-09-22 2020-02-25 Microsoft Technology Licensing, Llc Cross platform custom functions
CN111045878A (en) * 2019-12-03 2020-04-21 浪潮金融信息技术有限公司 Cross-browser financial self-service terminal hardware calling method based on WebSocket
CN113591006A (en) * 2021-08-10 2021-11-02 视若飞信息科技(上海)有限公司 Web extension method and device based on WebSocket
CN114356678A (en) * 2022-03-17 2022-04-15 北京奇立软件技术有限公司 Method and system for acquiring hardware information of equipment

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104301443A (en) * 2014-10-09 2015-01-21 百度在线网络技术(北京)有限公司 Method and system for calling end capacity ports on web page

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104301443A (en) * 2014-10-09 2015-01-21 百度在线网络技术(北京)有限公司 Method and system for calling end capacity ports on web page

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10572274B2 (en) 2017-09-22 2020-02-25 Microsoft Technology Licensing, Llc Cross platform custom functions
CN107888683A (en) * 2017-11-10 2018-04-06 郑州云海信息技术有限公司 A kind of client exchange method and device
CN109144579A (en) * 2018-07-17 2019-01-04 广州睿本信息科技有限公司 A kind of Web system reads the method and computer readable storage medium of hardware
CN109144579B (en) * 2018-07-17 2023-09-29 广州睿本信息科技有限公司 Method for reading hardware by Web system and computer readable storage medium
CN111045878A (en) * 2019-12-03 2020-04-21 浪潮金融信息技术有限公司 Cross-browser financial self-service terminal hardware calling method based on WebSocket
CN111045878B (en) * 2019-12-03 2022-08-05 浪潮金融信息技术有限公司 Cross-browser financial self-service terminal hardware calling method based on WebSocket
CN113591006A (en) * 2021-08-10 2021-11-02 视若飞信息科技(上海)有限公司 Web extension method and device based on WebSocket
CN114356678A (en) * 2022-03-17 2022-04-15 北京奇立软件技术有限公司 Method and system for acquiring hardware information of equipment
CN114356678B (en) * 2022-03-17 2022-06-14 北京奇立软件技术有限公司 Method and system for acquiring hardware information of equipment

Also Published As

Publication number Publication date
CN106257887B (en) 2019-06-18

Similar Documents

Publication Publication Date Title
CN106257887A (en) A kind of method that obtains client hardware information of sing on web Socket
CN104767775B (en) Web application information push method and system
US10834031B2 (en) Information exchange method, client, and apparatus
CN105302732B (en) A kind of automatic test approach and device of mobile terminal
CN103944906B (en) A kind of method guided for the HTTP flows of APP on iOS
CN105357323A (en) HTML5 page debugging method and device in APP
US20150358795A1 (en) Browser emergency call method, system, and mobile device in real-time communication
CN103929438B (en) Firewall traversal method, equipment and system based on web page browser communication
CN104778121A (en) Game program test method, device and system
CN104125145B (en) Web browser based communication method, web browser based communication equipment and web browser based communication system
CN104320327A (en) Method and system for enabling multiple roles of one account of social network to be online simultaneously
CN106357609A (en) User creation method and system, public network server and private cloud equipment
WO2015021873A1 (en) Method, platform server, and system of data pushing
CN103763125A (en) Statistical method and device for number of actual users in operator network
CN102647432B (en) A kind of authentication information transmission method, device and certification middleware
CN102752230A (en) Method and system for sharing subscriber relationship chain
CN101873593A (en) Android-based Wifi wireless dial system and method
CN104506405B (en) The method and device of cross-domain access
CN103916489B (en) The many IP of a kind of single domain name domain name analytic method and system
CN108062690A (en) Method, apparatus, electronic equipment and the storage medium of advertisement pushing
SG11201906705TA (en) Method for acquiring user information and relevant device
CN104541491A (en) Method, device and terminal for pushing webpage
CN105591965B (en) flow equalization output method and device
CN106789938B (en) Method for monitoring search trace of browser at mobile phone end in real time
CN105376254B (en) A kind of detection method of the whether successful passing through NAT of UPNP

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190618

Termination date: 20200618