drashland/wocket

Allow Specifying a Path, to Only Accept Conns On

ebebbington opened this issue · 0 comments

Summary

What:

Discussed with @saragee3 and she brought up the idea, which i think is a nice one: to allow the socket server to accept a path. This can help if there are multiple socket servers

Better if i explain in code (fairly pseudo-code):

// the dev's app.ts file
const socket = new SocketServer({
  path: "my_socket_server"
})
// Wockets internal server.ts file or whatever
acceptConn(socket => {
  if (this.path && socket.path !== this.path) {
    error("That path is not allowed")
// example how this would be used from the client
const clientOne = new Websocket("ws://loclahost:1337") // NOT ALLOWED
const clientTwo = ...("ws://.../my_socket_server") // ALLOWED

Why:

  • Can help manage multiple socket servers
  • I see the use cases
  • Doesn't restrict developers to only allowing /

Acceptance Criteria

Below is a list of tasks that must be completed before this issue can be closed.

  • Write documentation
  • Write unit tests
  • Write integration tests
  • Write feature