import { Controller } from "egg" ; export default class NspController extends Controller { async ping ( ) { const { ctx , app } = this ; const message = ctx . args [ 0 ] ; await ctx . socket . emit ( "res" , `Hi! I've got your message: ${ message }` ) ; } public async creatJob ( ) { const { ctx } = this ; const message = ctx . args [ 0 ] || { } ; try { const { payload } = message ; const { projectId , branchName = "master" , branchGitName , projectVersion = '0.0.01' , buildPath = './' , type = "h5" , cache , } = payload ; setTimeout ( ( ) => { ctx . socket . emit ( "res" , `Hi! I've got your message` ) ; } , 2000 ) ; } catch ( e ) { throw e ; } } }