Based on the instant communicating system that websocket is realized
Technical field
The utility model is related to network data processing technique, more particularly to it is a kind of based on websocket realize i.e.
When communication system.
Background technology
Technology introduction (for relative colleague's prior art) the integrated third-party platform, the 3rd platform for generally using at present
Based on xmpp agreements, xmpp is based on xml, and it defines three roles, client, server, gateway.Communication can be in this three
Any two between two-way generation.Server assume responsibility for the route work(of client-information records, connection management and information simultaneously
Can, gateway carries the interconnection with isomery instantaneous communication system, and basic latticed form is that single client passes through TCP/IP
Be connected to single server, between transmit xml.
With the presence of the data traffic of the server of usual 70% XMPP and nearly 60% repeatedly forwarded,
The agreement of xmpp possess at present one it is large-scale it is built on stilts present in data be supplied to multiple addressees, while the mode of xmpp agreements
An xml document for single length is encoded as, therefore modification binary data cannot be provided.Therefore, FTP one
Http of the sample outside.If inevitable, all data that xmpp agreements additionally provide the file transmission with coding are used
Or Base64. be placed in other binary data encrypt session figure in embedded use identical method.And message is too
Greatly, it appears too fat to move, flow is wasted.
In summary, prior art there will naturally be inconvenience and defect in actual use, it is therefore necessary to be improved.
Utility model content
For above-mentioned defect, the purpose of this utility model is to provide a kind of IMU realized based on websocket
News system, the data volume of its head file is smaller, the efficiency high of transmission.
To achieve these goals, the utility model provides a kind of instant communicating system realized based on websocket, bag
Client, gateway and server are included, the client and server is connected by gateway communication;
The gateway includes websocket duplex communication modules, the client and server be respectively provided with it is described
The corresponding protocol module of websocket duplex communication modules;
The client also has time frame module and information type judge module;
The server includes message transmission module and function call module.
Instant communicating system of the present utility model, including client, gateway and server, the client and server lead to
Cross gateway communication connection;The gateway includes websocket duplex communication modules, and the client is respectively provided with and institute with server
State the corresponding protocol module of websocket duplex communication modules;Also there is the client time frame module and information type to sentence
Disconnected module;The server includes message transmission module and function call module.Whereby, the data of the utility model head file
Amount is smaller, and the fragment than xml is smaller, the efficiency high of transmission.
Brief description of the drawings
Fig. 1 is system structure diagram of the present utility model.
Specific embodiment
In order that the purpose of this utility model, technical scheme and advantage become more apparent, below in conjunction with accompanying drawing and implementation
Example, is further elaborated to the utility model.It should be appreciated that specific embodiment described herein is only used to explain
The utility model, is not used to limit the utility model.
Referring to Fig. 1, the utility model provides a kind of instant communicating system realized based on websocket, including client
End 10, gateway 20 and server 30, the client 10 and server 30 are communicated to connect by gateway 20.
The gateway 20 includes websocket duplex communication modules 21, the client 10 and server 30 be respectively provided with
The corresponding protocol module of the websocket duplex communication modules 21;The client 10 also has time frame module 11 and letter
Breath type judging module 12;The server 30 includes message transmission module 31 and function call module 32.The utility model is passed
The data volume of head file is smaller during transmission of data, and the fragment than xml is smaller, the efficiency high of transmission.
Specifically, the utility model uses websocket duplex communications, based on Transmission Control Protocol, while mobile terminal can be realized
(Android, IOS's) is cross-platform, and client 10 sends heartbeat packet and server 30 by the fixed time interval of time frame module 11
Link long is set up, server 30 sends message by message transmission module 31, and is adjusted back by function call module 32
OnMessage methods, client 10 need to be only processed i.e. the data that corresponding server 30 sends inside the method
Can, client 30 will send message, it is only necessary to which binding incorporates the service of websocket, calls
The information for needing to send, is put into message by session.getAsyncRemote () .sendText (message) the method
In, information type judge module 12 made a distinction by field type (word, voice, picture, are input into, burn-after-reading,
Red packet, transfers accounts).
In sum, instant communicating system of the present utility model, including client, gateway and server, the client
Connected by gateway communication with server;The gateway includes websocket duplex communication modules, the client and server
It is respectively provided with protocol module corresponding with the websocket duplex communication modules;The client also have time frame module and
Information type judge module;The server includes message transmission module and function call module.Whereby, the utility model head
The data volume of file is smaller, and the fragment than xml is smaller, the efficiency high of transmission.
Certainly, the utility model can also have other various embodiments, spiritual and its essence without departing substantially from the utility model
In the case of, those of ordinary skill in the art work as can make various corresponding changes and deformation, but these according to the utility model
Corresponding change and deformation should all belong to the scope of the claims appended by the utility model.