-
Notifications
You must be signed in to change notification settings - Fork 48
/
endpoint.h
39 lines (34 loc) · 1.19 KB
/
endpoint.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef _ENDPOINT_H
#define _ENDPOINT_H
//[message type] ':' [message id ('+')] ':' [message endpoint] (':' [message data])
typedef struct {
char *message_type;
char *message_id;
char *endpoint;
char *message_data;
char *ori_data;
} message_fields;
typedef struct {
char *endpoint;
void (*on_init)(const char *endpoint);
void (*on_connect)(const char *sessionid);
void (*on_message)(const char *sessionid, const message_fields *msg_fields);
void (*on_json_message)(const char *sessionid, const message_fields *msg_fields);
void (*on_event)(const char *sessionid, const message_fields *msg_fields);
void (*on_other)(const char *sessionid, const message_fields *msg_fields);
void (*on_disconnect)(const char *sessionid, const message_fields *msg_fields);
void (*on_destroy)(const char *endpoint);
} endpoint_implement;
/**
* [send_msg description]
* @param sessionid [description]
* @param message [description]
*/
void send_msg(char *sessionid, char *message);
/**
* [broadcast_clients description]
* @param except_sessionid [description]
* @param message [description]
*/
void broadcast_clients(char *except_sessionid, char *message);
#endif