# Using a Bware Labs endpoint in code

Listed below you can find a simple code snippet demonstrating how to use a Bware Labs generated endpoint in your javascript code

```
init: function() {
        ws_provider = new Web3(new Web3.providers.WebsocketProvider ('wss://' 
        + 'eth-api.bwarelabs.com/ws/69231efa-e959-4fb0-ad08-9141cda9ea4d'));
        ws_provider.eth.net.getNetworkType().then((networkID) => {
            switch (networkID) {
                case "main":
                    this.chainID = ChainId.MAINNET;
                    this.network = 'homestead';
                    break;
                case "rinkeby":
                    this.chainID = ChainId.RINKEBY;
                    this.network = 'rinkeby';
                    break;
                default:
                    this.chainID = ChainId.MAINNET;
                    this.network = 'homestead';
            }
            logger.info(`Listening on the ${networkID} network...`);
        });
        oracle_provider = new ethers.providers.WebSocketProvider('wss://'
         + 'eth-api.bwarelabs.com/ws/69231efa-e959-4fb0-ad08-9141cda9ea4d', this.network);
    },

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.bwarelabs.com/tutorials/using-a-bware-labs-endpoint-in-code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
