# Caverjs websocket으로 연결하여 subscribe를 수행 시 ERROR: Couldn't connect to node on WS. 에러가 발생합니다

**URL:** <https://devforum.kaia.io/t/caverjs-websocket-subscribe-error-couldnt-connect-to-node-on-ws/1840>\
**Category:** Kaia\
**Created:** [9월 11, 2021, 10:28오전 UTC](https://devforum.kaia.io/t/caverjs-websocket-subscribe-error-couldnt-connect-to-node-on-ws/1840 "2021-09-11T10:28:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hlib](https://yyz1.discourse-cdn.com/flex035/user_avatar/devforum.kaia.io/hlib/32/687_2.png) [@hlib](https://devforum.kaia.io/u/hlib)\
**Post date:** [9월 11, 2021, 10:28오전 UTC](https://devforum.kaia.io/t/caverjs-websocket-subscribe-error-couldnt-connect-to-node-on-ws/1840/1 "2021-09-11T10:28:59Z")

</div>

안녕하세요?

질문과 같이 caverjs를 websocket으로 연결하여 subscribe를 수행했는데 ERROR: Couldn’t connect to node on WS. 에러가 발생합니다.

서비스체인을 구축했구요.

transaction을 블록에 쓰는 경우에도 http로는 잘 되는데 websocket으로 하면 에러가 발생합니다.

caverjs 버전은 1.6.4를 사용합니다.

혹시 조치해야 할 만한 사항이 있을까요?

감사합니다.

---

<div class="post-metadata">

**Author:** ![Kale](https://yyz1.discourse-cdn.com/flex035/user_avatar/devforum.kaia.io/kale/32/148_2.png) [@Kale](https://devforum.kaia.io/u/Kale)\
**Post date:** [9월 13, 2021, 12:48오전 UTC](https://devforum.kaia.io/t/caverjs-websocket-subscribe-error-couldnt-connect-to-node-on-ws/1840/2 "2021-09-13T00:48:17Z")

</div>

안녕하세요. @hlib

혹시 구축하신 서비스체인 노드에 websocket과 관련된 설정을 하셨을까요?

kend.conf에서 아래와 같이 설정 해주시고 다시 확인 부탁드립니다.

- WS\_ENABLE값을 1로 설정
- WS\_API에 klay이외에 사용하시고자하는 API의 namespace를 추가

```auto
# rpc options setting
RPC_ENABLE=1 # if this is set, the following options will be used
RPC_API="mainbridge,klay,admin,debug,miner,net,personal,rpc,account,txpool,web3"
RPC_PORT=8551
RPC_ADDR="0.0.0.0"
RPC_CORSDOMAIN="*"
RPC_VHOSTS="*"

# ws options setting
WS_ENABLE=1 # if this is set, the following options will be used
WS_API="mainbridge,admin,klay,debug,miner,net,txpool,personal,web3" # available apis: admin,debug,klay,miner,net,personal,rpc,txpool,web3
WS_ADDR="0.0.0.0"
WS_PORT=8552
WS_ORIGINS="*"

```
