Real time api closing websocket connection after using a tool

I’m writing shop assitant app on React using openai-realtime-api-beta
and untill last week all was working well, but seemingly out of nowhere started receiving ‘WebSocket is already in CLOSING or CLOSED state.’ after using any of several addTools i have in the app. While no tool is beign trigger everything working smoothly.

For example i have a tool called add_to_cart which is tiggered when user asks to add some merch from the store to the cart right now the code from the body of this tool is executed correctly and even if remove the body leaving just and empty func the issue still presits so i’m sure the issue is not the func it self, but immeditly after the realtime responds with audio stream saying something among the lines of ‘item {x} is added to the cart’ i get an error. The code of that tool is presented below.

client.addTool(
        {
          name: 'add_to_cart',
          description: 'Add the item to the cart. Call this whenever you need to add something to the cart, for example when user asks "Add x to the cart".',
          parameters: {
            type: 'object',
            properties: {
              name: {
                type: 'string',
                description:
                  'The name of the item user wants to add. Always use lowercase, no other characters.',
              },
              quantity: {
                type: 'number',
                description:
                  'The quantity of item user wants to add. Always use numbers.',
              }
            },
            required: ['name'],
          },
        },
        async ({ name, quantity = 1 }) => {
          setCart((current) => [
            ...current,
            { name, quantity }
          ])
          eventSender.fireEvent("EnterCart")
          alert(`${name?.toUpperCase()} added to cart`)
        }
);