개발63 Django Channels - Introduction Scope란 connection의 정보를 뜻한다. remote IP, username, lifetime of connection등의 정보를 가지고 있다. Application은 한번의 scope당 한번씩 instantiate된다. HTTP에서는 각 request마다, socket에서는 각 WebSocket connection마다이다. Consumer 각각의 프로토콜은 각자 다른 event들이 발생하며 이 event들은 메소드로 표현된다. 개발자는 각각의 event들을 어떻게 처리할지 코드만 작성하면 Django의 Channel이 스케쥴링과 병렬적으로 실행시켜준다. class LogConsumer(WebsocketConsumer): def connect(self, message): Log.objects.c.. 2020. 3. 18. Django Channels - Consumers Consumer하는 일 중 몇가지: - 이벤트가 발생했을 때 사용할 함수를 작성하기만 하면 된다. event loop전체를 다 쓸 필요가 없다. - synchronous / asynchronous 코드를 작성하기만 하면 threading을 포함한 나머지를 다 처리해준다. Consumer Events from channels.consumer import SyncConsumer class EchoConsumer(SyncConsumer): def websocket_connect(self, event): self.send({ "type": "websocket.accept", }) def websocket_receive(self, event): self.send({ "type": "websocket.send", .. 2020. 3. 18. Janus media server 설치하기 설치하는 과정을 편하게 Dockerfile로 만들었다. 기존에 다른사람이 올려놓은 Dockerfile은 최신 janus와 안맞아서 패키지들을 최신가이드에 맞게 바꿔주었다. 이미지 빌드와 실행은 repository의 readme에 나와있다. https://github.com/cjsjyh/janus_server ========================= Official Repository: https://github.com/meetecho/janus-gateway ReadMe를 따라서 진행하다가 안되서 추가된 부분들이 있다. aptitude install libmicrohttpd-dev libjansson-dev \ libssl-dev libsrtp-dev libsofia-sip-ua-dev libgli.. 2020. 3. 17. Intel Open WebRTC Toolkit 클라이언트 삽질기 Client코드를 작성하기 앞서, Intel에서 제공한 샘플코드를 참고하여 사용하는 법을 익히려고 합니다. 모든 코드는 아래의 참고자료의 owt-client-javascript repo를 기준으로 합니다 src/samples/conference/public/scripts/index.js를 보면 기본적인 conference를 생성/접속하는 법이 나와있는 것 같다. 134번째 줄부터 시작하는 window.onload에 createToken을 하고, 만들어진 tokenString을 callback함수에 넘겨 conference에 입장한다. createToken()은 src/samples/conference/public/scripts/rest-sample.js에 있다. 이 부분은 자신의 필요에 맞게 바꾸면 될것.. 2020. 3. 13. 8. GraphQL Introspection # What is Introspection Inspection is the ability to query details about the current API's schema. ``` query { __schema { // introspection! types { name description } } } ``` 2019. 12. 26. 7. GraphQL Subscription --- # What is Subscription Subscription is used when the client wants real-time updates pushed from the server. ``` subscription liftStatusChange { name capacity status } } ``` 2019. 12. 26. 이전 1 ··· 3 4 5 6 7 8 9 ··· 11 다음