# How to use Single Websocket Connection for all the virtual users and also refresh it periodically based on a token

**URL:** <https://community.gatling.io/t/how-to-use-single-websocket-connection-for-all-the-virtual-users-and-also-refresh-it-periodically-based-on-a-token/8040>\
**Category:** Gatling (Open-Source)\
**Created:** [June 16, 2023, 3:20pm UTC](https://community.gatling.io/t/how-to-use-single-websocket-connection-for-all-the-virtual-users-and-also-refresh-it-periodically-based-on-a-token/8040 "2023-06-16T15:20:06Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![GeMi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/gemi/32/939_2.png) [@GeMi](https://community.gatling.io/u/GeMi)\
**Post date:** [June 17, 2023, 9:41am UTC](https://community.gatling.io/t/how-to-use-single-websocket-connection-for-all-the-virtual-users-and-also-refresh-it-periodically-based-on-a-token/8040/4 "2023-06-17T09:41:34Z")

</div>

For refresh token you can check:

> [@Token Refresh - Java - Example](https://community.gatling.io/t/token-refresh-java-example/7935):
>
> I see that lot of people asking about solution to refresh Token when expired. I have prepared Case0022SetOrRefreshTokenSimulation where Token is refreshed every some period of time. What you think about this solution @slandelle @sbrevet ?

---

_[View the full topic](https://community.gatling.io/t/how-to-use-single-websocket-connection-for-all-the-virtual-users-and-also-refresh-it-periodically-based-on-a-token/8040)._
