hi ,
Regarding as I need to convert a " browser websocket javascript code " to “Unity WebGL Javascript code”.
Not possible. JavaScript in Unity isn’t real JavaScript for websites behaviors construction (mostly). Community calls for it “UnityScript”. Therefore in Unity you writing scripts to set behaviors for objects. How do you want “transfer” code to object that never exists? You have to create a scene, place objects and then you can define specific behavior by scripting.