Finally I find this project, https://github.com/Azure-Samples/AzureSpeechReactSample
which shows the correct way to use speech sdk in frontend.
You don't need to connect your own server via websocket, just generate a temporary token and use the Azure Speech SDK directly in the frontend. This project provides a sample implementation using React.