File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -112,7 +112,7 @@ result.code()
112112 +---------------------------------+----------------------------------------------+---------------------------------------------------------------------------------------+
113113 | Type | Value | Description |
114114 +=================================+==============================================+=======================================================================================+
115- | studio.protocol.AuthResultCode | Optional: One of the following: |
115+ | studio.protocol.AuthResultCode | Optional: One of the following: | |
116116 + +----------------------------------------------+---------------------------------------------------------------------------------------+
117117 | | - eCredentialsRequired | |
118118 + +----------------------------------------------+---------------------------------------------------------------------------------------+
Original file line number Diff line number Diff line change @@ -714,7 +714,7 @@ studio.internal = (function(proto) {
714714 var appConnection = this ;
715715 var appName = "" ;
716716 var appId = undefined ;
717- var appUrl = ( location . protocol == "https:" ? proto . WSS_PREFIX : proto . WS_PREFIX ) + url ;
717+ var appUrl = composeUrl ( url ) ;
718718 var socket = new WebSocket ( appUrl ) ;
719719 var handler = new proto . Handler ( socket , notificationListener ) ;
720720 var requests = [ ] ;
@@ -803,6 +803,22 @@ studio.internal = (function(proto) {
803803 socket . onmessage = onMessage ;
804804 socket . onerror = onError ;
805805
806+ function composeUrl ( url ) {
807+ var result = ( location . protocol == "https:" ? proto . WSS_PREFIX : proto . WS_PREFIX ) + url ; //default
808+ if ( URL . canParse ( url ) ) {
809+ var u = new URL ( url ) ;
810+ if ( u . protocol && u . host ) {
811+ if ( u . protocol == "https:" )
812+ result = proto . WSS_PREFIX + u . host ;
813+ else if ( u . protocol == "http:" )
814+ result = proto . WS_PREFIX + u . host ;
815+ else
816+ result = u . origin ;
817+ }
818+ }
819+ return result ;
820+ }
821+
806822 function send ( message ) {
807823 if ( socket . readyState == WebSocket . OPEN ) {
808824 socket . send ( message . toArrayBuffer ( ) ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " cdp-client" ,
3- "version" : " 2.2.2 " ,
3+ "version" : " 2.3.0 " ,
44 "description" : " A simple Javascript interface for the CDP Studio development platform that allows Javascript applications to interact with" ,
55 "main" : " index.js" ,
66 "scripts" : {
You can’t perform that action at this time.
0 commit comments