In general there are already some chat plugins available in the market. Ref:
https://themeisle.com/blog/best-live-chat-plugins-wordpress/ or search on google by typing "wordpress chat plugin".
Instead of developing a script from the scratch, if I were you then I would use a ready-made one first. I would the customize the existing one to meet my needs. Hope it helps.
Good luck
These unfortunately have a monthly fee. Here's an example: Price: premium plans start at $16/month. I'm pretty sure that people would prefer a one-time payment. That doesn't mean that some of them aren't much cheaper and better than what you or me could develop, so I think they might be worth itv if you're running a business.
If OP can afford such thing then why not? If he do tends to develop script or using up ready made ones then its his choice but I agree on what you said which if you are running a business then
consider this thing to be add up on the expense.
Having a Chat in gambling site is a must yet this would give out interaction or gateway for people to express or talk into other players.