-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathws_notify_api.pks
157 lines (155 loc) · 6.89 KB
/
ws_notify_api.pks
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
CREATE OR REPLACE PACKAGE ws_notify_api IS
--
-- API Package Spec for Node Notify Websocket REST Calls
--
--
-- Websocket REST Call defaults
--
g_ws_rest_host VARCHAR2(50) := 'localhost';
g_ws_rest_port VARCHAR2(50) := '8080';
g_ws_rest_path VARCHAR2(50) := '/notifyuser';
g_ws_rest_proto VARCHAR2(50) := 'http'; -- http or https
g_ws_rest_base_url VARCHAR2(200) := ws_notify_api.g_ws_rest_proto ||
'://' || ws_notify_api.g_ws_rest_host || ':' ||
ws_notify_api.g_ws_rest_port ||
ws_notify_api.g_ws_rest_path;
-- security defaults
g_ws_basic_auth_user VARCHAR2(100) := '';
g_ws_basic_auth_pwd VARCHAR2(100) := '';
-- wallet info: only if g_ws_rest_proto = https
g_ssl_wallet_path VARCHAR2(200) := 'file:/home/oracle/wallet'; -- set your local wallet path
g_ssl_wallet_pwd VARCHAR2(100) := 'pwd'; -- set your wallet password
--
-- Exceptions Error Codes
--
error_http_status_code CONSTANT NUMBER := -20002;
--
-- Public Functions and Procedures
--
-- Send Websocket Notification over REST to connected users
-- #param i_userid
-- #param i_room ("private" or "public")
-- #param i_type (info, success, warn, error)
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_rest_notify_user(i_userid IN VARCHAR2,
i_room IN VARCHAR2,
i_type IN VARCHAR2,
i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
--
-- Send Websocket Notification to User / Room: Private / Type: Info
-- #param i_userid
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_notify_user_private_info(i_userid IN VARCHAR2,
i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
--
-- Send Websocket Notification to User / Room: Private / Type: Success
-- #param i_userid
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_notify_user_private_success(i_userid IN VARCHAR2,
i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
--
-- Send Websocket Notification to User / Room: Private / Type: Warn
-- #param i_userid
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_notify_user_private_warn(i_userid IN VARCHAR2,
i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
--
-- Send Websocket Notification to User / Room: Private / Type: Error
-- #param i_userid
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_notify_user_private_error(i_userid IN VARCHAR2,
i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
--
-- Send Websocket Notification to User / Room: Public / Type: Info
-- #param i_userid
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_notify_user_public_info(i_userid IN VARCHAR2,
i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
--
-- Send Websocket Notification to User / Room: Public / Type: Success
-- #param i_userid
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_notify_user_public_success(i_userid IN VARCHAR2,
i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
--
-- Send Websocket Notification to User / Room: Public / Type: Warn
-- #param i_userid
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_notify_user_public_warn(i_userid IN VARCHAR2,
i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
--
-- Send Websocket Notification to User / Room: Public / Type: Error
-- #param i_userid
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_notify_user_public_error(i_userid IN VARCHAR2,
i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
--
-- Send Websocket Notification to all Users / Room: Public / Type: Info
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_notify_all_public_info(i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
--
-- Send Websocket Notification to all Users / Room: Public / Type: Success
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_notify_all_public_success(i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
--
-- Send Websocket Notification to all Users / Room: Public / Type: Warn
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_notify_all_public_warn(i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
--
-- Send Websocket Notification to all Users / Room: Public / Type: Error
-- #param i_title
-- #param i_message
-- #param i_optparam (Optional Parameter String)
PROCEDURE do_notify_all_public_error(i_title IN VARCHAR2,
i_message IN VARCHAR2,
i_optparam IN VARCHAR2 := NULL);
END ws_notify_api;
/