WebSockets
Navigate to :
http://bit.ly/APEXHTML5 (case sensitive!)
Code
-- Make sure that ACLs are set accordingly
-- Sample code to send message from DB to beaconpush
declare
v_clob clob;
v_msg varchar2(1000) := 'TODO Some message here';
begin
v_clob := APEX_WEB_SERVICE.MAKE_REST_REQUEST(
p_url => 'http://api.beaconpush.com/1.0.0/[API KEY]/channels/mychannel', -- TODO confirm the URL based on your account
p_http_method => 'POST',
p_body => '{' || apex_javascript.add_attribute('message', v_msg, false, false) || '}'
);
end;
/
ACL-Setting (run as SYS)
begin
dbms_network_acl_admin.create_acl
( acl => 'beaconpush.xml'
, description => 'Beaconpush ACL'
, principal => 'APEX_040100'
, is_grant => true
, privilege => 'connect'
, start_date => null
, end_date => null
);
commit;
end;
begin
dbms_network_acl_admin.assign_acl
( acl => 'beaconpush.xml'
, host => 'api.beaconpush.com'
, lower_port => null
, upper_port => null
);
commit;
end;
| |
|
|