How to establish connection between server side socket in meteor and client side socket in html/javascript

I have tried to implement like shown below, but two problems I am facing.

  1. I cannot expose io Object to client that I get from npm library when its installed in meteor server and tried to access in client by adding a script tag shown below.
    <script src="http://localhost:3000/"></script>
    However, I solved it by fetching the io Object from cdnjs library.
    <script src=""></script>

  2. Getting CORS error when trying to connect to server socket from client.
    client.js (file not in meteor) file has
    var socket = io('http://localhost:3000');
    server.js (file in meteor) file has

import socket_io from '';
Meteor.startup(() => {
const server = http.createServer();
const io = socket_io(server);

Any leads would be appreciated, thanks!