-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
39 lines (37 loc) · 915 Bytes
/
test.js
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
class App extends Component {
constructor(props) {
super(props);
this.server = 'wss://natsdemo.voxo.co:443';
this.doConnect();
}
doConnect() {
connect({servers: [this.server]})
.then((nc) => {
this.nc = nc;
this.nc.jetstreamManager()
.then((jsm) => {
this.jsm = jsm;
console.info(`connected jsm`);
this.jsm.streams.add({name: "my", subjects: ["my.>"]})
.then((info) => {
console.info(info);
})
})
.catch((err) => {
console.error(`failed to connect to jetstream: ${err}`);
})
})
.catch((err) => {
console.error(`failed to connect: ${err}`);
})
}
render() {
return (
<div className="App">
<header className="App-header">
Hello NATS.ws!!!
</header>
</div>
);
}
}