http

package
v0.0.0-...-e8179cd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

freelancer의 http 통신과 관련된 내용을 담습니다. 클라이언트들은 이 패키지의 문서를 통해 어떠한 형식의 데이터를 전달해야하는지, 자신이 받는 데이터가 어떠한 형식인지를 파악할 수 있습니다.

Index

Constants

This section is empty.

Variables

View Source
var (
	// 현재 연결되어있는 websocket connection들
	WebsocketConnections = []*websocket.Conn{}
)

Functions

func NewEcho

func NewEcho() *echo.Echo

Echo 서버를 run할 수 있는 *echo.Echo type을 생성합니다.

Types

type AddRequest

type AddRequest struct {
	Number int
}

Task나 Freelancer를 추가할 때 클라이언트가 보내주어야하는 body 형식

type SocketMessage

type SocketMessage struct {
	Type string
	Data interface{} // 어떤 타입이든 가능
}

websocket을 통해 클라이언트에게 메시지를 보낼 때 사용하는 타입.

Type 은 주로 타입의 이벤트가 발생하였는지를 의미하고, Data 는 현재 발생한 이벤트가 전달하고싶은 정보를 의미한다. Data 에는 어떠한 자료형도 올 수 있지만, 전송될 때에는 JSON 형태로 전송된다.

클라이언트는 어떤 이벤트 핸들러가 어떤 Type에 의해 어떤 동작을 할 지 정의하고, 그 동작 시에 필요한 data는 Data에서 얻을 수 있다.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL