corba.js 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,6 +109,8 @@ Here are example implementations for the client and server defined earlier:
|
|
|
109
109
|
The server side initialization:
|
|
110
110
|
|
|
111
111
|
```javascript
|
|
112
|
+
import { WsProtocol } from "corba.js/net/ws"
|
|
113
|
+
|
|
112
114
|
let orb = new ORB()
|
|
113
115
|
|
|
114
116
|
// create the server implementation
|
|
@@ -122,23 +124,25 @@ The server side initialization:
|
|
|
122
124
|
orb.registerStubClass(stub.Client)
|
|
123
125
|
|
|
124
126
|
// listen for incoming WebSocket connections
|
|
125
|
-
|
|
127
|
+
const protocol = new WsProtocol()
|
|
128
|
+
orb.addProtocol(protocol)
|
|
129
|
+
protocol.listen(orb, 8809)
|
|
126
130
|
```
|
|
127
131
|
|
|
128
132
|
The client side initialization:
|
|
129
133
|
|
|
130
134
|
```javascript
|
|
135
|
+
import { WsProtocol } from "corba.js/net/browser"
|
|
136
|
+
|
|
131
137
|
let orb = new ORB()
|
|
138
|
+
orb.addProtocol(new WsProtocol())
|
|
132
139
|
|
|
133
140
|
// for the client, the server is a remote object,
|
|
134
141
|
// so we need to register the server's stub
|
|
135
142
|
orb.registerStubClass(stub.Server)
|
|
136
143
|
|
|
137
|
-
// connect to the WebSocket server
|
|
138
|
-
orb.connect("ws://somehostname:8000/")
|
|
139
|
-
|
|
140
144
|
// find the object registered as "MyServer"
|
|
141
|
-
|
|
145
|
+
const object = orb.stringToObject("corbaname::localhost:8809#MyServer")
|
|
142
146
|
|
|
143
147
|
// try to cast it to type stub.Server
|
|
144
148
|
let server = stub.Server.narrow(object)
|
|
@@ -156,10 +160,6 @@ The client side initialization:
|
|
|
156
160
|
console.log(server.add(3, 2))
|
|
157
161
|
```
|
|
158
162
|
|
|
159
|
-
Note to self: The narrow() is a classic CORBA function, but I guess we could reduce it to
|
|
160
|
-
|
|
161
|
-
let server = await orb.resolve<Server>("MyServer")
|
|
162
|
-
|
|
163
163
|
## Security Model
|
|
164
164
|
|
|
165
165
|
corba.js 0.0.x did not implement CORBA's security model and instead relies on
|
package/package.json
CHANGED